SQL Database Basic Query Selection Quiz

SQL Database
0 Passed
0% acceptance

A 40-question challenge focused on SELECT operations including filtering, sorting, limiting, pattern matching, aliases, expressions, and DISTINCT usage.

40 Questions
~80 minutes
1

Question 1

What is the primary purpose of a SELECT statement?

A
Retrieve data
B
Remove tables
C
Alter constraints
D
Encrypt a table
2

Question 2

What does the * symbol mean when used in a SELECT clause?

A
Return all columns
B
Return numeric columns only
C
Multiply numeric values
D
Cause an error
3

Question 3

Why might selecting specific columns instead of * be beneficial?

A
It reduces unnecessary output
B
It deletes unwanted columns
C
It disables ordering
D
It hides error messages
4

Question 4

Which clause chooses where data is retrieved from?

A
FROM
B
ORDER BY
C
LIMIT
D
AS
5

Question 5

Which keyword filters rows based on conditions?

A
WHERE
B
ORDER
C
BY
D
LIMIT
6

Question 6

Which operator checks inequality in many query dialects?

A
<>
B
=
C
#
D
:
7

Question 7

DISTINCT is used to:

A
Remove duplicates from results
B
Rename columns
C
Sort rows
D
Delete redundant rows
8

Question 8

What does ORDER BY do?

A
Sorts returned rows
B
Filters values
C
Creates new columns
D
Removes duplicates
9

Question 9

Which keyword limits how many rows a query returns?

A
LIMIT
B
ORDER
C
FROM
D
LIKE
10

Question 10

Why use column aliases?

A
To improve readability
B
To change the column type
C
To delete unwanted rows
D
To create new tables
11

Question 11

What does this return?

sql
SELECT name FROM staff;
A
The name column from staff
B
All columns
C
Only the first row
D
No rows
12

Question 12

Which rows appear?

sql
SELECT * FROM orders WHERE status = 'pending';
A
Rows where status is pending
B
Every order
C
Only completed orders
D
No orders
13

Question 13

Interpret this:

sql
SELECT * FROM items WHERE price > 20;
A
Items with price greater than 20
B
Items costing exactly 20
C
Every item
D
Only cheapest items
14

Question 14

What is the effect?

sql
SELECT email FROM users ORDER BY email DESC;
A
Emails sorted Z to A
B
Emails sorted A to Z
C
Random ordering
D
Emails removed
15

Question 15

What result is returned?

sql
SELECT * FROM sales LIMIT 5;
A
First five rows
B
All rows
C
Last five rows
D
No rows
16

Question 16

Predict the output:

sql
SELECT DISTINCT city FROM customers;
A
Unique city values
B
All customers
C
Only first 3 cities
D
Cities sorted descending
17

Question 17

What does LIKE do here?

sql
SELECT * FROM users WHERE name LIKE 'A%';
A
Find names starting with A
B
Find names ending with A
C
Find names containing no A
D
Sort the names
18

Question 18

Interpret this:

sql
SELECT name, age FROM members WHERE age BETWEEN 20 AND 30;
A
Members aged 20–30 inclusive
B
Members under 20 only
C
All members
D
Members over 50
19

Question 19

What is the result?

sql
SELECT id, (price * quantity) AS total FROM orders;
A
A calculated total for each order
B
Only the price column
C
Random numeric values
D
No output due to error
20

Question 20

What does this return?

sql
SELECT UPPER(name) FROM authors;
A
All names in uppercase
B
Names in lowercase
C
Only authors with short names
D
Only first names
21

Question 21

What rows appear?

sql
SELECT * FROM invoices WHERE paid = 0;
A
Unpaid invoices
B
Paid invoices only
C
All invoices
D
No invoices
22

Question 22

Interpret the sorting:

sql
SELECT name FROM employees ORDER BY age, name;
A
Sorted by age then by name
B
Sorted only by name
C
Sorted randomly
D
Sorted by name then age
23

Question 23

What does this produce?

sql
SELECT LENGTH(title) FROM books;
A
Character length for each title
B
Only short titles
C
All book IDs
D
Duplicate titles removed
24

Question 24

Evaluate the effect:

sql
SELECT price FROM products ORDER BY price ASC LIMIT 1;
A
The cheapest product price
B
The most expensive product price
C
Only the average price
D
No rows
25

Question 25

What does this LIKE pattern match?

sql
SELECT * FROM items WHERE code LIKE 'AB_';
A
Codes starting with AB plus one more character
B
Codes starting with A only
C
Codes ending with AB
D
Codes containing no AB
26

Question 26

What is the outcome?

sql
SELECT name, age FROM users WHERE age <> 18;
A
All users except age 18
B
Only users age 18
C
No users
D
Only the oldest user
27

Question 27

Interpret this calculation:

sql
SELECT price - discount FROM products;
A
The net price after discount
B
The original price only
C
The discount only
D
Random values
28

Question 28

What does this return?

sql
SELECT COUNT(*) FROM visits;
A
Number of rows in visits
B
The largest visit count
C
Only the first row
D
Duplicate rows removed
29

Question 29

How is the result sorted?

sql
SELECT title FROM films ORDER BY title DESC;
A
Z to A
B
A to Z
C
By length
D
Random order
30

Question 30

What is returned?

sql
SELECT name FROM clients LIMIT 1;
A
The first row's name
B
All names
C
Names in descending order
D
Only clients older than 50
31

Question 31

Which wildcard matches any sequence of characters?

A
%
B
_
C
#
D
?
32

Question 32

Which wildcard matches exactly one character?

A
_
B
%
C
!
D
~
33

Question 33

Which operator joins multiple filter conditions?

A
AND / OR
B
JOIN
C
AS
D
LIMIT
34

Question 34

Which clause is used to rename a column?

A
AS
B
NEW
C
RENAME
D
SET
35

Question 35

Which clause appears last logically in a typical SELECT?

A
ORDER BY
B
FROM
C
WHERE
D
SELECT
36

Question 36

Selecting too many columns may:

A
Reduce readability
B
Improve performance always
C
Delete unneeded data
D
Rename stored fields
37

Question 37

Why might DISTINCT reduce row count?

A
It removes duplicates
B
It filters out errors
C
It sorts rows automatically
D
It enforces ordering rules
38

Question 38

Which clause determines which table to retrieve from?

A
FROM
B
ORDER BY
C
LIMIT
D
LIKE
39

Question 39

Expressions in SELECT are used to:

A
Calculate or transform values
B
Delete table rows
C
Create new tables
D
Store binary data
40

Question 40

What makes SELECT a foundational query?

A
It retrieves meaningful data from stored information
B
It creates new tables automatically
C
It replaces all other commands
D
It removes constraints

QUIZZES IN SQL Database