All for Joomla All for Webmasters

SQL SELECT AS

SQL AS is used to assign temporarily a new name to a table column.

It makes easy presentation of query results and allows the developer to label results more accurately without permanently renaming table columns.

Let’s see the example of select as:

  1. SELECT day_of_order AS “Date”
  2. Customer As “Client”,
  3. Product,
  4. Quantity,
  5. FROM orders;

Let us take a table named orders, it contains:

Day_of_order Customer Product Quantity
11-09-2001 Osama bin qasim airplane 2
13-12-2001 Mukhtar mahmood RDX 20
26-12-2004 Balaswamy Water cannon 35

After applying this SQL AS example syntax

  1. SELECT day_of_order AS “Date”
  2. Customer As “Client”,
  3. Product,
  4. Quantity,
  5. FROM orders;

Result will be shown as this table:

Date Client Product Quantity
11-09-2001 Osama bin qasim airplane 2
13-12-2001 Mukhtar mahmood RDX 20
26-12-2004 Balaswamy Water cannon 35

Note: SQL AS is same as SQL ALIAS

PinIt
submit to reddit

Leave a Reply

Top