MySQL

R4R® MySQL
(追記) (追記ここまで)
(追記) (追記ここまで)
Alias in MySQL

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.

(追記) (追記ここまで)
Copyright ©2021-22 r4r.co.in, all rights reserved. Theguestspost.com
Sitemap
Career
Post comment
About us
Subscription
Unsubscription

AltStyle によって変換されたページ (->オリジナル) /