Wednesday, 26 June 2013

How to use SQL As Command

sql - as

In previous chapter i have explained you How To Use Where Command In Sql
.Now i am gonna eplain you How to use SQL As Command

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

No comments: