SQL Aliases Statement

SQL Aliases are used to give temporary names to tables and columns. If users want the name to be more readable than the Aliases used.The Aliases only gives temporary names does not change in the original database.Aliases are usually preferred when a query includes more than one table.

Aliases statement Syntax :

The syntax of the Aliases statement is −

Alias Column Syntax
--------------------
SELECT column-name AS alias-name
FROM table-name;
--------------------
--------------------
Alias Table Syntax
-------------------
SELECT column-name(s)
FROM table-name AS alias-name;



Aliases statement Example :

Consider the Customer table with the following records -

CustomerID CustomerName Age Address CustomerSalary Gender
1 Aarav 28 Udaipur 28000 M
2 Aarushi 25 Mumbai 30000 F
3 Reyansh 28 Chennai 35000 M
4 Aditi 24 Udaipur 50000 F
5 Sai 30 Mumbai 27000 M


Alias for Columns Examples:- The following code is an example that will temporarily change the column name to "Name" :-

SELECT CustomerName AS Name FROM Customer; 


The result for the respective sql query is as follows −

Name
Aarav
Aarushi
Reyansh
Aditi
Sai



Alias for Tables Examples:- The following code is an example that will temporarily change the table name to C :-

SELECT CustomerName FROM Customer AS C; 


The result for the respective sql query is as follows −

CustomerName
Aarav
Aarushi
Reyansh
Aditi
Sai





Visit :


Discussion



* You must be logged in to add comment.

pHqghUme
555

pHqghUme
555

pHqghUme
555

pHqghUme
-1 OR 2+977-977-1=0+0+0+1 --

pHqghUme
-1 OR 3+977-977-1=0+0+0+1 --

pHqghUme
-1 OR 3*2<(0+5+977-977) --

pHqghUme
-1 OR 3*2>(0+5+977-977) --

pHqghUme
-1 OR 2+661-661-1=0+0+0+1

pHqghUme
-1 OR 3+661-661-1=0+0+0+1

pHqghUme
-1 OR 3*2<(0+5+661-661)

pHqghUme
-1 OR 3*2>(0+5+661-661)

pHqghUme
-1' OR 2+612-612-1=0+0+0+1 --

pHqghUme
-1' OR 3+612-612-1=0+0+0+1 --

pHqghUme
-1' OR 3*2<(0+5+612-612) --

pHqghUme
-1' OR 3*2>(0+5+612-612) --

pHqghUme
-1' OR 2+150-150-1=0+0+0+1 or 'JiQG7Btk'='

pHqghUme
-1' OR 3+150-150-1=0+0+0+1 or 'JiQG7Btk'='

pHqghUme
-1' OR 3*2<(0+5+150-150) or 'JiQG7Btk'='

pHqghUme
-1' OR 3*2>(0+5+150-150) or 'JiQG7Btk'='

pHqghUme
-1" OR 2+376-376-1=0+0+0+1 --

pHqghUme
-1" OR 3+376-376-1=0+0+0+1 --

pHqghUme
-1" OR 3*2<(0+5+376-376) --

pHqghUme
-1" OR 3*2>(0+5+376-376) --

pHqghUme
if(now()=sysdate(),sleep(15),0)

pHqghUme
0'XOR(if(now()=sysdate(),sleep(15),0))XOR'Z

pHqghUme
0"XOR(if(now()=sysdate(),sleep(15),0))XOR"Z

pHqghUme
(select(0)from(select(sleep(15)))v)/*'+(select(0)from(select(sleep(15)))v)+'"+(select(0)from(select(sleep(15)))v)+"*/

pHqghUme
-1; waitfor delay '0:0:15' --

pHqghUme
-1); waitfor delay '0:0:15' --

pHqghUme
1 waitfor delay '0:0:15' --

pHqghUme
RHF49040'; waitfor delay '0:0:15' --

pHqghUme
-5 OR 326=(SELECT 326 FROM PG_SLEEP(15))--

pHqghUme
-5) OR 867=(SELECT 867 FROM PG_SLEEP(15))--

pHqghUme
-1)) OR 417=(SELECT 417 FROM PG_SLEEP(15))--

pHqghUme
sBU5iozY' OR 268=(SELECT 268 FROM PG_SLEEP(15))--

pHqghUme
2AlAv1d0') OR 678=(SELECT 678 FROM PG_SLEEP(15))--

pHqghUme
MJNLBdV8')) OR 965=(SELECT 965 FROM PG_SLEEP(15))--

pHqghUme
555*DBMS_PIPE.RECEIVE_MESSAGE(CHR(99)||CHR(99)||CHR(99),15)

pHqghUme
555'||DBMS_PIPE.RECEIVE_MESSAGE(CHR(98)||CHR(98)||CHR(98),15)||'

pHqghUme
1'"

pHqghUme

pHqghUme
@@MJnBL

pHqghUme
555

pHqghUme
555

pHqghUme
555