select as sql code example

Example 1: sql as

Renames a table or column with an alias value which only exists for the
duration of the query.
Example: Aliases north_east_user_subscriptions column
SELECT north_east_user_subscriptions AS ne_subs
FROM users
WHERE ne_subs > 5;

Example 2: sql as

SELECT CustomerID AS ID, CustomerName AS Customer

Example 3: sql as

-- AS is a keyword that allows you to rename a column or table using an alias
SELECT column_name AS 'Alias'
FROM table_name;

Example 4: select in select sql

SELECT column-names  FROM table-name1 WHERE value IN (SELECT column-name                   FROM table-name2                   WHERE condition)

Tags:

Sql Example