

0 / 2 embers
0 / 3000 xp
click for more info
Complete a lesson to start your streak
click for more info
Difficulty: 4
click for more info
Not enough gems
Cost: 6 gems
1: AS Clause in SQL
incomplete
2: SQL Functions
incomplete
3: Between
incomplete
4: Distinct
incomplete
5: Logical Operators – AND
incomplete
6: OR
incomplete
7: In
incomplete
8: Like
incomplete
9: Underscore Operator
incomplete
10: Wildcards Quiz
incomplete
11: Query Practice – Discount Program
incomplete
Back
ctrl+,
Next
ctrl+.
This lesson's interactive features are locked, please to keep using them
Sometimes we need to structure the data we return from our queries in a specific way. An AS clause allows us to "alias" a piece of data in our query. The alias exists only for the duration of the query.
The following queries return the same data:
SELECT employee_id AS id, employee_name AS name
FROM employees;
SELECT employee_id, employee_name
FROM employees;
The difference is that the results from the aliased query would have column names id and name instead of employee_id and employee_name.
Throughout the course, use aliases only when requested.
A user has asked us to find all the transactions on their account from their grandmother. We thought it would be fun to rename the note field to birthday_message because we noticed all the transactions from Grandma are birthday messages.