Renaming columns - sql, PL-SQL Programming

Assignment Help:

Renaming Columns - SQL

SQL has no direct counterpart of RENAME. To derive the table on the right in Figure 4.4 from the table on the left, Tutorial D has IS_CALLED RENAME ( StudentId AS Sid ).

1010_Renaming Columns - SQL.png

                                                    Figure: Tables differing only in a column name

It shows how the same effect can be achieved in SQL. Note that the SELECT clause has to include all the columns that are not subject to renaming, as well as those that are.

Example: Renaming a column

SELECT StudentId AS Sid, Name

FROM IS_CALLED

Explanation

  • Each element of a SELECT clause is an expression of arbitrary complexity that can reference one or more columns of the SELECT clause's input table. Note that the expression is not required to reference any columns: it might be just a literal, for example.
  • If the expression consists of just a column reference, then the name of the referenced column is the name of the corresponding column in the result.
  • If the expression is followed by the key word AS, then the resulting column has the column name given after that key word.

SQL allows the result to have two or more columns of the same name. For example, if we replace Sid by Name in Example, we still have a valid SQL SELECT expression.


Related Discussions:- Renaming columns - sql

Explicitly specifying the join condition - sql, Explicitly specifying the j...

Explicitly specifying the join condition - SQL SELECT * FROM IS_CALLED JOIN IS_ENROLLED_ON ON ( IS_CALLED.StudentId = IS_ENROLLED_ON.StudentId ) Now, the key word JO

Change sql file into csv for product registration, Change Sql file into CSV...

Change Sql file into CSV for product registration on Magento Project Description: I have a set of files that are in Sql format and could like for a developer to help me with

Calling constructors in pl sql, Calling Constructors: The Calls to a c...

Calling Constructors: The Calls to a constructor are allowed wherever the function calls are allowed. Similarly to the functions, a constructor is called as a section of an ex

Null statement-sequential control, NULL Statement The NULL statement c...

NULL Statement The NULL statement clearly specifies in action; it does nothing other than to pass control to the next statement. It can, though, improve the readability. In a

Bulk binds advantages, Bulk Binds advantages In the Embedded Oracle RDB...

Bulk Binds advantages In the Embedded Oracle RDBMS, the PL/SQL engines accept any valid PL/SQL subprogram or block. As the figure shows, the PL/SQL engine executes all procedur

Example of tables within a table - sql, Example of Tables within a Table - ...

Example of Tables within a Table - SQL Example: Obtaining C_ER from COURSE and EXAM_MARK SELECT CourseId, CAST (TABLE (SELECT DISTINCT StudentId, Mark FROM EXAM_MARK AS EM

Using default-declarations in sql, Using DEFAULT You can use the keyword...

Using DEFAULT You can use the keyword DEFAULT rather than that of the assignment operator to initialize the variables. For e.g. the declaration blood_type CHAR := ’O’; it can b

Theory of spontaneous generation - origin of life, THEORY OF SPONTANEOUS GE...

THEORY OF SPONTANEOUS GENERATION - ABIOGENESIS OR AUTOGENESIS - According to this theory, the existing living communities have originated from non-living organic matter with

Recursion versus iteration, Recursion versus Iteration Dissimilar the i...

Recursion versus Iteration Dissimilar the iteration, recursion is not crucial to PL/SQL programming. Any problem which can be solved using recursion can be solving using the it

Example of not exists operator - sql, Example of NOT EXISTS Operator - SQL ...

Example of NOT EXISTS Operator - SQL Example is a translation into SQL of the corresponding example, which is included there merely to show that for any scalar comparison the

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd