Bird
Raised Fist0
SQLquery~20 mins

What is SQL - Practice Questions & Exercises

Choose your learning style10 modes available
Challenge - 5 Problems
🎖️
SQL Beginner Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
1:00remaining
What does SQL stand for?
Choose the correct full form of SQL.
ASequential Question Logic
BSimple Query List
CStandard Question Language
DStructured Query Language
Attempts:
2 left
💡 Hint
Think about the language used to ask questions to databases.
🧠 Conceptual
intermediate
1:30remaining
What is the main purpose of SQL?
What is SQL mainly used for in databases?
ATo create and manage database structures and data
BTo design website layouts
CTo write software applications
DTo manage operating system files
Attempts:
2 left
💡 Hint
SQL helps you work with data stored in databases.
❓ query_result
advanced
2:00remaining
What is the output of this SQL query?
Given the table Users with columns id and name, what will this query return?

SELECT name FROM Users WHERE id = 3;
SQL
CREATE TABLE Users (id INT, name VARCHAR(20));
INSERT INTO Users VALUES (1, 'Alice'), (2, 'Bob'), (3, 'Charlie');
ABob
BCharlie
CAlice
DNo rows returned
Attempts:
2 left
💡 Hint
Look for the row where id equals 3.
📝 Syntax
advanced
1:30remaining
Which SQL statement is syntactically correct to create a table?
Choose the correct SQL statement to create a table named Products with columns product_id (integer) and product_name (text).
ACREATE TABLE Products (product_id INT, product_name TEXT);
BTABLE CREATE Products (product_id INT, product_name TEXT);
CCREATE Products TABLE (product_id INT, product_name TEXT);
DCREATE TABLE Products product_id INT, product_name TEXT;
Attempts:
2 left
💡 Hint
The correct syntax starts with CREATE TABLE followed by the table name and columns in parentheses.
🧠 Conceptual
expert
2:00remaining
Which SQL command is used to remove all rows from a table but keep the table structure?
Select the SQL command that deletes all data from a table but does not delete the table itself.
AREMOVE FROM table_name;
BDROP TABLE table_name;
CTRUNCATE TABLE table_name;
DDELETE FROM table_name;
Attempts:
2 left
💡 Hint
This command is faster than DELETE and resets identity counters.

Practice

(1/5)
1. What is the main purpose of SQL?
easy
A. To design website layouts
B. To manage and manipulate data in databases
C. To write computer games
D. To create graphic designs

Solution

  1. Step 1: Understand SQL's role

    SQL is a language used to work with data stored in databases.
  2. Step 2: Compare options

    Only To manage and manipulate data in databases describes managing and manipulating data, which is what SQL does.
  3. Final Answer:

    To manage and manipulate data in databases -> Option B
  4. Quick Check:

    SQL = Data management [OK]
Hint: SQL is for data, not design or games [OK]
Common Mistakes:
  • Confusing SQL with programming languages
  • Thinking SQL is for web design
  • Mixing SQL with graphic tools
2. Which of the following is a correct SQL command to get data from a table named users?
easy
A. GET * FROM users;
B. FETCH ALL users;
C. SELECT * FROM users;
D. SHOW DATA users;

Solution

  1. Step 1: Recall SQL syntax for retrieving data

    The correct command to get all data from a table is SELECT * FROM table_name;.
  2. Step 2: Match options with correct syntax

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

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

    SELECT = retrieve data [OK]
Hint: Use SELECT to get data from tables [OK]
Common Mistakes:
  • Using GET instead of SELECT
  • Using FETCH or SHOW incorrectly
  • Missing FROM keyword
3. What will this SQL query return?
SELECT name FROM employees WHERE age > 30;
medium
A. All employee names with age less than 30
B. An error because of wrong syntax
C. All employee names regardless of age
D. All employee names with age greater than 30

Solution

  1. Step 1: Understand the SELECT and WHERE clause

    The query selects the name column from employees where the age is greater than 30.
  2. Step 2: Interpret the condition

    The condition age > 30 means only employees older than 30 are included.
  3. Final Answer:

    All employee names with age greater than 30 -> Option D
  4. Quick Check:

    WHERE age > 30 filters older employees [OK]
Hint: WHERE filters rows by condition [OK]
Common Mistakes:
  • Confusing > with <
  • Ignoring WHERE clause
  • Assuming all rows are returned
4. Identify the error in this SQL statement:
SELEC name FROM customers;
medium
A. Incorrect keyword 'SELEC' instead of 'SELECT'
B. Missing semicolon at the end
C. Table name 'customers' is invalid
D. No columns specified to select

Solution

  1. Step 1: Check SQL keywords

    The keyword to get data is SELECT, but here it is misspelled as SELEC.
  2. Step 2: Verify other parts

    The table name and column are valid, and the semicolon is optional in many systems.
  3. Final Answer:

    Incorrect keyword 'SELEC' instead of 'SELECT' -> Option A
  4. Quick Check:

    Correct spelling of SELECT is required [OK]
Hint: Check spelling of SQL keywords carefully [OK]
Common Mistakes:
  • Misspelling keywords
  • Assuming semicolon is mandatory
  • Confusing table and column names
5. You want to add a new user named 'Alice' with age 28 to a table users with columns name and age. Which SQL command should you use?
hard
A. INSERT INTO users (name, age) VALUES ('Alice', 28);
B. UPDATE users SET name = 'Alice', age = 28;
C. SELECT name, age FROM users WHERE name = 'Alice';
D. DELETE FROM users WHERE name = 'Alice';

Solution

  1. Step 1: Understand the goal

    You want to add a new row (user) to the table, so you need to insert data.
  2. Step 2: Identify the correct command

    INSERT INTO adds new rows; UPDATE changes existing rows; SELECT reads data; DELETE removes data.
  3. Final Answer:

    INSERT INTO users (name, age) VALUES ('Alice', 28); -> Option A
  4. Quick Check:

    INSERT adds new data [OK]
Hint: Use INSERT to add new rows [OK]
Common Mistakes:
  • Using UPDATE to add data
  • Confusing SELECT with INSERT
  • Deleting instead of adding
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