0
0
SQLquery~10 mins

How SQL communicates with the database engine - Interactive Practice

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

Complete the code to select all columns from the table named 'employees'.

SQL
SELECT [1] FROM employees;
Drag options to blanks, or click blank then click option'
A*
BALL
Ccolumns
Deverything
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'ALL' instead of '*'
Writing 'columns' which is not valid SQL syntax
2fill in blank
medium

Complete the code to filter rows where the 'age' column is greater than 30.

SQL
SELECT * FROM users WHERE age [1] 30;
Drag options to blanks, or click blank then click option'
A<
B>
C=
D<=
Attempts:
3 left
💡 Hint
Common Mistakes
Using '<' which means less than
Using '=' which means equal to
3fill in blank
hard

Fix the error in the SQL query to count the number of rows in the 'orders' table.

SQL
SELECT COUNT([1]) FROM orders;
Drag options to blanks, or click blank then click option'
Aorder_id
Brows
Call
D*
Attempts:
3 left
💡 Hint
Common Mistakes
Using a column name that might have NULLs and cause incorrect counts
Using 'all' or 'rows' which are not valid SQL keywords here
4fill in blank
hard

Fill both blanks to select the 'name' and 'salary' columns from 'employees' where salary is at least 50000.

SQL
SELECT [1], [2] FROM employees WHERE salary >= 50000;
Drag options to blanks, or click blank then click option'
Aname
Bsalary
Cage
Ddepartment
Attempts:
3 left
💡 Hint
Common Mistakes
Selecting columns not related to the condition
Mixing up column names
5fill in blank
hard

Fill all three blanks to create a query that selects 'product', counts 'sales', and filters where sales are more than 100.

SQL
SELECT [1], COUNT([2]) FROM sales_data GROUP BY [3] HAVING COUNT([2]) > 100;
Drag options to blanks, or click blank then click option'
Aproduct
Bsale_id
Dcustomer
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong columns in COUNT or GROUP BY
Not matching COUNT column in HAVING clause