Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 3

--COLUMN ALIAS

It is the other/temporary name provided for a COLUMBIA

It provides its effect only in the output of a query or its usage till the query is in execution.

It cannot be used in other clauses of SELECT statement except ORDER BY clause

when COLUMN ALIAS is specified directly it does not allow blank spaces and special

characters except underscores.

In order to have blank spaces and special characters it should be enclosed in Double Quotes

и or or Square Brackets

It can be specified in two ways:

with using "AS" Key word

with out using

"AS" Key word

Examples:

SELECT EMPNO ECODE, ENAME EPPNAME FROM EMP

SELECT EMPNO AS ECODE, ENAME AS EMPNAME FROM EHP

SELECT EMPNO ECODE, SAL MONTHLY_SAL FROM EMP

SELECT EMPNO ECODE SAL "MONTHLY PAY® FROM EMP

SELECT EMPNO ECODE SAL [MONTHLY PAY) FROM EMP

--USING LITERALS IN A SELECT STATEMENT

Literals refer to a constraint which means input provided for a query the same is provided in the
output

= A literal can be of numeric, string and date type data

Examples:

SELECT ENAME FROM EMP

SELECT "ENAME" FROM EMP

SELECT "ENAME"

SELECT 5QL + "SERVER" + 2005

SELECT ‘SQL 'LI, 'SERVER’ L2 , '2005' L3

SELECT ENAME + ‘WORKING AS ‘+ JOB RESULT FROM EMP

Select * from emp

Using mathematical expression in select statement


An expression which is consisting of arithmetic operators like +,-,*,/,%

Examples-

Select 10+20 [for addition]

Select 10+20 [for multiplication]

Select 5/2 – will treat as integer

Select 5/2.0

Select 10+5* 6 m1,(10+5) * 6 m2

You might also like