Previous | Home | Next |
Alias is use to create an assumed name, but that can be temporarily a table or a column heading.
Syntax for columns
SELECT columnname AS alias_name FROM tablename WHERE Clause ;
Syntax for table
SELECT columnname FROM tablename AS alias_name WHERE Clause ;
Here we have shown some examples
Example
SELECT fname as Name FROM studinfo ;
Making alias of more than one column in a single command.
Example
SELECT fname as Name , lname as lastname FROM studinfo ;
The where condition also use to filter the results according to the specifird conditions
Example
SELECT fname as Name , lname as lastname FROM studinfo WHERE sid > 105;
In the above code we can also use the Order by conditions.
we can also create an alias on a table, the alias for the table is called table alias. Like the column alias, the 'AS' keyword is optional so you can omit it also. We can use the table alias in those statement that contains INNER JOIN, LEFT JOIN, self join clauses, and in subqueries.
Previous | Home | Next |