Bird
Raised Fist0
SQLquery~10 mins

How SQL communicates with the database engine - Interactive Practice

Choose your learning style10 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

Practice

(1/5)
1. What is the main role of SQL when working with a database engine?
easy
A. To store data physically on the disk
B. To send instructions that the database engine executes
C. To design the hardware of the database server
D. To create user interfaces for database applications

Solution

  1. Step 1: Understand SQL's purpose

    SQL is a language used to communicate commands to the database engine.
  2. Step 2: Identify the database engine's role

    The database engine executes these commands to manage data.
  3. Final Answer:

    To send instructions that the database engine executes -> Option B
  4. Quick Check:

    SQL sends instructions = A [OK]
Hint: SQL sends commands to the engine, not hardware or UI [OK]
Common Mistakes:
  • Confusing SQL with physical data storage
  • Thinking SQL designs hardware
  • Assuming SQL creates user interfaces
2. Which of the following is the correct way to write a SQL command to select all columns from a table named users?
easy
A. SELECT * FROM users;
B. GET ALL FROM users;
C. SHOW * FROM users;
D. FETCH ALL users;

Solution

  1. Step 1: Recall SQL SELECT syntax

    The correct syntax to get all columns is SELECT * FROM table_name;.
  2. Step 2: Match syntax to options

    Only SELECT * FROM users; matches the correct SQL syntax.
  3. Final Answer:

    SELECT * FROM users; -> Option A
  4. Quick Check:

    Correct SELECT syntax = B [OK]
Hint: Use SELECT * FROM table; to get all columns [OK]
Common Mistakes:
  • Using non-SQL keywords like GET or FETCH
  • Omitting FROM keyword
  • Using SHOW incorrectly
3. Given the table employees with columns id, name, and salary, what will this SQL query return?
SELECT name FROM employees WHERE salary > 50000;
medium
A. Syntax error due to incorrect WHERE clause
B. All columns of employees earning more than 50000
C. Names of employees earning less than 50000
D. Names of employees earning more than 50000

Solution

  1. Step 1: Analyze the SELECT clause

    The query selects only the name column.
  2. Step 2: Analyze the WHERE condition

    It filters rows where salary > 50000, so only employees earning more than 50000 are included.
  3. Final Answer:

    Names of employees earning more than 50000 -> Option D
  4. Quick Check:

    SELECT name with salary > 50000 = D [OK]
Hint: WHERE filters rows; SELECT chooses columns [OK]
Common Mistakes:
  • Confusing column selection with all columns
  • Misreading > as <
  • Thinking WHERE causes syntax error
4. Identify the error in this SQL query:
SELEC name FROM customers;
medium
A. Table name is incorrect
B. Missing FROM keyword
C. Misspelled SELECT keyword
D. No error, query is correct

Solution

  1. Step 1: Check SQL keywords

    The keyword SELECT is misspelled as SELEC.
  2. Step 2: Verify other parts

    The FROM keyword and table name customers are correct.
  3. Final Answer:

    Misspelled SELECT keyword -> Option C
  4. Quick Check:

    Keyword spelling error = C [OK]
Hint: Check spelling of SQL keywords carefully [OK]
Common Mistakes:
  • Ignoring small typos in keywords
  • Assuming table name is wrong without checking
  • Thinking missing FROM when it is present
5. You want to get the total number of rows in the orders table. Which SQL command correctly communicates this request to the database engine?
hard
A. SELECT COUNT(*) FROM orders;
B. COUNT * FROM orders;
C. GET TOTAL orders;
D. SELECT TOTAL FROM orders;

Solution

  1. Step 1: Recall aggregate function syntax

    To count rows, use SELECT COUNT(*) FROM table;.
  2. Step 2: Match options to correct syntax

    Only SELECT COUNT(*) FROM orders; uses the correct SQL syntax with SELECT and COUNT(*).
  3. Final Answer:

    SELECT COUNT(*) FROM orders; -> Option A
  4. Quick Check:

    Correct COUNT syntax = A [OK]
Hint: Use SELECT COUNT(*) FROM table; to count rows [OK]
Common Mistakes:
  • Omitting SELECT keyword
  • Using non-SQL commands like GET or TOTAL
  • Misplacing COUNT function
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard