About Me

Wednesday, 18 April 2012

SQL - As

SQL - As

SQL AS temporarily assigns a table column a new name. This grants the SQL developer the ability to make adjustments to the presentation of query results and allow the developer to label results more accurately without permanently renaming table columns.

SQL Select As Code:

USE mydatabase;

SELECT day_of_order AS "Date", 
customer As "Client", 
product, 
quantity
FROM orders;

SQL Orders Table Results:

DateClientproductquantity
2008-08-01 00:00:00.000TizagPen4
SQL AS allows us to use any name at the presentation level and helps the developer better describe a column in the result set.

SQL Select Arithmetic Query:

USE mydatabase;

SELECT (5 + 12) AS "5 plus 12 is"

SQL Arithmetic Results:

5 plus 12 is
17

0 comments:

Post a Comment