0
0
SQLquery~20 mins

What is a database in SQL - Practice Questions & Exercises

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Database Basics Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
1:00remaining
Understanding the core purpose of a database

Which of the following best describes the main purpose of a database?

ATo create graphics and animations for websites
BTo write and compile programming code
CTo store and organize data so it can be easily accessed and managed
DTo design user interfaces for mobile apps
Attempts:
2 left
💡 Hint

Think about what you do when you want to keep information safe and find it quickly later.

🧠 Conceptual
intermediate
1:00remaining
Identifying database components

Which of these is NOT a typical component of a database system?

AWeb browser for internet surfing
BData storage
CUser interface for data entry
DDatabase Management System (DBMS)
Attempts:
2 left
💡 Hint

Think about what parts help manage data versus what is used for browsing the internet.

query_result
advanced
1:30remaining
Query result from a simple database table

Given a table Users with columns id and name, what is the result of this query?

SELECT name FROM Users WHERE id = 2;
SQL
CREATE TABLE Users (id INT, name VARCHAR(20));
INSERT INTO Users VALUES (1, 'Alice'), (2, 'Bob'), (3, 'Charlie');
A[]
B[{'id': 2}]
C[{'name': 'Alice'}]
D[{'name': 'Bob'}]
Attempts:
2 left
💡 Hint

Look for the row where id equals 2 and return the name.

📝 Syntax
advanced
1:30remaining
Identify the syntax error in SQL query

Which option contains a syntax error in the SQL query?

SELECT * FROM Customers WHERE age > 30;
ASELECT * Customers WHERE age > 30;
B;03 > ega EREHW sremotsuC MORF * TCELES
CSELECT * FROM Customers WHERE age > 30
DSELECT * FROM Customers WHERE age > 30;
Attempts:
2 left
💡 Hint

Check if the keyword FROM is used correctly.

optimization
expert
2:00remaining
Optimizing a database query for performance

You have a large table Orders with millions of rows. Which query is likely to run faster?

Option 1: SELECT * FROM Orders WHERE order_date = '2023-01-01';
Option 2: SELECT * FROM Orders WHERE YEAR(order_date) = 2023 AND MONTH(order_date) = 1 AND DAY(order_date) = 1;
AOption 2 runs faster because it breaks the date into parts.
BOption 1 runs faster because it can use an index on order_date directly.
CBoth run at the same speed because they filter the same data.
DNeither runs faster; a full table scan is always needed.
Attempts:
2 left
💡 Hint

Think about how indexes work with functions on columns.