SQL Database Filter, Sort, and Alias Essentials Quiz

SQL Database
0 Passed
0% acceptance

A 50-question quiz focused on filtering rows, sorting results, and using aliases to improve query readability and control output.

50 Questions
~100 minutes
1

Question 1

Which clause filters rows in a query?

A
WHERE
B
ORDER BY
C
AS
D
GROUP
2

Question 2

What does the operator <> mean?

A
Not equal
B
Greater than
C
Equal to
D
Pattern match
3

Question 3

Which logical operator requires both conditions to be true?

A
AND
B
OR
C
NOT
D
LIKE
4

Question 4

Filtering using LIKE 'A%' matches values that:

A
Start with A
B
End with A
C
Contain no A
D
Contain exactly one A
5

Question 5

What does BETWEEN 5 AND 10 include?

A
5 through 10 inclusive
B
Only 5 and 10
C
Values less than 5
D
Values greater than 10
6

Question 6

Which rows appear?

sql
SELECT * FROM users WHERE age >= 21;
A
Users age 21 and above
B
Users under 21
C
Only the oldest user
D
No rows
7

Question 7

Interpret this:

sql
SELECT * FROM orders WHERE total < 100;
A
Orders less than 100
B
Orders equal to 100
C
Orders above 100
D
All orders
8

Question 8

What does this match?

sql
SELECT * FROM items WHERE name LIKE '%box';
A
Names ending with 'box'
B
Names starting with 'box'
C
Names containing no 'box'
D
All item names
9

Question 9

What is returned?

sql
SELECT * FROM employees WHERE dept = 'IT' AND active = 1;
A
Active employees in IT
B
All employees
C
Inactive employees
D
Only managers
10

Question 10

Which rows appear?

sql
SELECT * FROM sales WHERE region <> 'East';
A
All regions except East
B
Only East
C
Only West
D
No rows
11

Question 11

Which clause sorts rows?

A
ORDER BY
B
WHERE
C
AS
D
WITH
12

Question 12

Which keyword sorts lowest to highest?

A
ASC
B
DESC
C
TOP
D
FIRST
13

Question 13

Which sorting is applied first when multiple columns are listed?

A
The leftmost column
B
The rightmost column
C
Whichever is numeric
D
Random
14

Question 14

Why sort results?

A
To present data in logical order
B
To delete rows
C
To rename columns
D
To modify structure
15

Question 15

Sorting text alphabetically uses:

A
ORDER BY column
B
LIMIT
C
LIKE
D
BETWEEN
16

Question 16

How are results sorted?

sql
SELECT name FROM team ORDER BY name ASC;
A
A to Z
B
Z to A
C
Random order
D
Grouped by team
17

Question 17

Which list is returned?

sql
SELECT id FROM logs ORDER BY timestamp DESC;
A
Newest entries first
B
Oldest entries first
C
Unsorted entries
D
Only recent errors
18

Question 18

Interpret the order:

sql
SELECT price FROM menu ORDER BY price, name;
A
Sorted by price, with ties broken by name
B
Sorted by name only
C
Random order
D
Sorted by price descending only
19

Question 19

How many rows are returned?

sql
SELECT * FROM grades ORDER BY score DESC LIMIT 3;
A
The top three rows
B
All rows
C
Only scores under 3
D
Only unique scores
20

Question 20

Which name appears first?

sql
SELECT name FROM users ORDER BY LENGTH(name) ASC;
A
Shortest name first
B
Longest name first
C
Alphabetical only
D
Random order
21

Question 21

How will these be sorted?

sql
SELECT id FROM posts ORDER BY id DESC;
A
Highest id to lowest
B
Lowest id to highest
C
Grouped by category
D
Unsorted
22

Question 22

What order results?

sql
SELECT city FROM addresses ORDER BY city;
A
Alphabetical A to Z
B
Z to A
C
Sorted by length
D
No sorting
23

Question 23

Which keyword creates a column alias?

A
AS
B
NEW
C
ALIAS
D
TITLE
24

Question 24

Why use aliases?

A
To improve output clarity
B
To change stored column names
C
To delete duplicates
D
To apply filters automatically
25

Question 25

Which is a valid alias?

A
SELECT price AS total_price
B
SELECT price RENAME total
C
SELECT price CHANGE total
D
SELECT price MAP total
26

Question 26

Aliases help when:

A
Column names are unclear
B
Values need deletion
C
Duplicates must be removed
D
Tables must be dropped
27

Question 27

Aliases can rename:

A
Columns or expressions
B
Entire tables permanently
C
Primary keys
D
Constraints
28

Question 28

Column aliases apply:

A
Only to returned results
B
To the stored schema
C
To internal indexes
D
To access permissions
29

Question 29

What is the output label?

sql
SELECT name AS full_name FROM users;
A
full_name
B
name
C
user_name
D
label
30

Question 30

What does this produce?

sql
SELECT price * 1.1 AS adjusted_price FROM products;
A
A new column named adjusted_price
B
The original price only
C
Random values
D
Multiple columns
31

Question 31

What label appears?

sql
SELECT UPPER(name) AS upper_name FROM contacts;
A
upper_name
B
name
C
uppercase
D
None
32

Question 32

Interpret the alias:

sql
SELECT id AS identifier FROM accounts;
A
identifier
B
id
C
account_id
D
primary
33

Question 33

Which column name is shown?

sql
SELECT quantity * price AS revenue FROM sales;
A
revenue
B
price
C
quantity
D
amount
34

Question 34

Which alias is valid?

sql
SELECT city AS town FROM addresses;
A
town
B
city
C
place
D
zone
35

Question 35

Which heading appears?

sql
SELECT CONCAT(first, ' ', last) AS full_name FROM people;
A
full_name
B
first
C
last
D
name
36

Question 36

Filtering with AND requires:

A
Both conditions true
B
At least one true
C
Neither true
D
Random evaluation
37

Question 37

Filtering with OR requires:

A
At least one condition true
B
Both conditions true
C
Conditions false
D
Always-true results
38

Question 38

Which phrase sorts descending?

A
ORDER BY amount DESC
B
ORDER amount DESC
C
SORT amount HIGH
D
ORDER DOWN amount
39

Question 39

Using LIMIT with ORDER BY helps:

A
Show only top or bottom results
B
Rename columns
C
Store fewer rows
D
Remove duplicates
40

Question 40

Which pattern matches any three-character string starting with X?

A
X__
B
X%
C
X_
D
%X
41

Question 41

Which clause appears last logically?

A
ORDER BY
B
FROM
C
WHERE
D
AS
42

Question 42

Filtering text often uses:

A
LIKE
B
SUM
C
ORDER
D
AS
43

Question 43

Which operator negates a condition?

A
NOT
B
LIKE
C
TOP
D
BETWEEN
44

Question 44

What does ORDER BY name, age do?

A
Sorts by name, then age within ties
B
Sorts by age only
C
Sorts randomly
D
Filters by age first
45

Question 45

AS is important because it:

A
Improves readability of returned columns
B
Creates permanent column names
C
Deletes old column names
D
Sorts numeric columns
46

Question 46

Which operator supports flexible matching?

A
LIKE
B
BETWEEN
C
IN
D
AND
47

Question 47

Filtering numeric ranges can be simplified using:

A
BETWEEN
B
LIKE
C
AS
D
ORDER
48

Question 48

Which expression filters out all rows except those equal to 2023?

A
year = 2023
B
year <> 2023
C
year > 2023
D
year < 2023
49

Question 49

Sorting by multiple columns is helpful when:

A
Data contains ties in the first sort column
B
Data must be filtered
C
Tables must be dropped
D
Numeric types must change
50

Question 50

Why combine filtering, sorting, and aliasing?

A
To retrieve the right rows, in the right order, with clear labels
B
To permanently restructure the table
C
To delete unused columns
D
To remove all duplicate data

QUIZZES IN SQL Database