Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to rename the column 'name' as 'employee_name'.
SQL
SELECT name [1] employee_name FROM employees; Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'IS' or 'TO' instead of 'AS' for aliasing columns.
✗ Incorrect
In SQL, AS is used to give a column a new name (alias) in the result.
2fill in blank
mediumComplete the code to rename the column 'salary' as 'monthly_salary'.
SQL
SELECT salary [1] monthly_salary FROM payroll; Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'TO' or 'IS' instead of 'AS' for column aliasing.
✗ Incorrect
The AS keyword is used to assign an alias to a column in SQL queries.
3fill in blank
hardFix the error in the code to correctly alias the column 'age' as 'user_age'.
SQL
SELECT age [1] user_age FROM users; Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'IS' or 'TO' instead of 'AS' causes SQL syntax errors.
✗ Incorrect
The correct keyword to alias a column is AS. Using other words causes syntax errors.
4fill in blank
hardFill both blanks to rename 'price' as 'item_price' and 'quantity' as 'item_quantity'.
SQL
SELECT price [1] item_price, quantity [2] item_quantity FROM inventory;
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using different keywords for each alias or incorrect keywords.
✗ Incorrect
Use AS to alias both columns correctly in the SELECT statement.
5fill in blank
hardFill all three blanks to rename 'first_name' as 'fname', 'last_name' as 'lname', and 'dob' as 'birth_date'.
SQL
SELECT first_name [1] fname, last_name [2] lname, dob [3] birth_date FROM people;
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing alias keywords or using incorrect ones like 'IS' or 'TO'.
✗ Incorrect
The AS keyword is used for all column aliases in this query.