0
0
MySQLquery~10 mins

Table aliases in MySQL - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to assign an alias c to the table customers.

MySQL
SELECT * FROM customers [1];
Drag options to blanks, or click blank then click option'
AAS c
Bc
CALIAS c
Dc AS
Attempts:
3 left
💡 Hint
Common Mistakes
Putting the alias before the table name.
Using the word ALIAS which is not valid in MySQL.
Omitting the AS keyword but placing alias incorrectly.
2fill in blank
medium

Complete the code to select the name column from the table employees using alias e.

MySQL
SELECT [1] FROM employees AS e;
Drag options to blanks, or click blank then click option'
Aemployees.name
Be.name
Cname
Demployees AS e.name
Attempts:
3 left
💡 Hint
Common Mistakes
Using the full table name instead of the alias.
Omitting the alias and just writing the column name when ambiguous.
Trying to alias the column incorrectly.
3fill in blank
hard

Fix the error in the code by completing the alias for the table orders as o.

MySQL
SELECT o.order_id FROM orders [1];
Drag options to blanks, or click blank then click option'
AALIAS o
Bo AS
CAS o
DAS
Attempts:
3 left
💡 Hint
Common Mistakes
Placing the alias before the AS keyword.
Using unsupported keywords.
Omitting the alias name.
4fill in blank
hard

Fill both blanks to alias tables products as p and categories as c in the JOIN.

MySQL
SELECT p.product_name, c.category_name FROM products [1] JOIN categories [2] ON p.category_id = c.id;
Drag options to blanks, or click blank then click option'
AAS p
Bp AS
CAS c
Dc AS
Attempts:
3 left
💡 Hint
Common Mistakes
Swapping the alias and AS keyword.
Using unsupported keywords.
Forgetting to alias one of the tables.
5fill in blank
hard

Fill all three blanks to alias students as s, select s.name as student_name, and filter where s.age is greater than 18.

MySQL
SELECT [1] AS student_name FROM students [2] WHERE [3] > 18;
Drag options to blanks, or click blank then click option'
As.name
BAS s
Cs.age
Dstudents AS s
Attempts:
3 left
💡 Hint
Common Mistakes
Not using the alias in the WHERE clause.
Trying to alias the column incorrectly.
Using the full table name instead of the alias.