The AS keyword
Part of the Fundamentals section of Coddy's SQL journey. Lesson 21 of 72.
Clear and descriptive column names are essential for presenting data in a meaningful way. If you show a table with bad column names, it will be hard for your audience to understand what you are talking about.
To rename a column in the query result you may use the AS keyword. The new name only changes the result's column header: the table itself keeps its original column names.
SELECT col1 AS firstColumn, col2 AS secondColumn, ...
FROM table1Challenge
EasyAvailable tables and columns:
kitchen_items:cutlery,amount
Fetch all of the kitchen items whose amount is less than 3. Return both columns: cutlery renamed to silverware, and amount.
Try it yourself
This lesson includes a short quiz. Start the lesson to answer it and track your progress.
All lessons in Fundamentals
4More Keywords
The IN keywordThe BETWEEN keywordThe LIKE keywordThe AS keywordRecap - Cellphone Models2Conditions
Conditions BasicsThe AND keywordThe OR keywordThe NOT keywordMultiple Conditions CombinedParenthesisBooleans5Arithmetic Operations
Mathematical OperatorsMathematical ColumnsThe Modulo OperationThe ROUND() Function3Specific Return Format
Null valuesSort Results Part 1Sort Results Part 2Recap - Cyber Security FirmLimit number of recordsRecap - Vehicle Factory6Intro Challenges
Recap - Parliamentary ElectionRecap - Police Criminal ArrestRecap - Bar Beverage ContainerRecap - Engineer new columnsPractice on your own: SQL playground