SQL Database Null and Type Essentials Quiz

SQL Database
0 Passed
0% acceptance

A 40-question quiz exploring how NULL behaves, how data types work, conversions, comparisons, and common pitfalls.

40 Questions
~80 minutes
1

Question 1

When reviewing a column storing optional notes from users, you notice some rows contain no value at all. What concept represents this intentional 'no value'?

A
NULL
B
0
C
Empty string
D
Undefined type
2

Question 2

A team is checking incomplete records. They want to find entries where a phone number hasn’t been provided yet. Which comparison style should they rely on?

A
IS NULL
B
= NULL
C
<> NULL
D
LIKE NULL
3

Question 3

While designing a table, you want a column that always contains a number. Which type best fits this requirement?

A
INTEGER
B
TEXT
C
DATE
D
BOOLEAN
4

Question 4

A developer compares a column to NULL using =. The condition never seems to match. What explains this?

A
NULL cannot be compared using =
B
NULL always equals zero
C
NULL is automatically converted to 1
D
NULL is treated like text
5

Question 5

When storing product names, which data type generally fits best?

A
VARCHAR
B
INTEGER
C
DATE
D
BOOLEAN
6

Question 6

A user accidentally leaves a comment field blank. Which value reflects the difference between a blank string and a true NULL?

A
Blank strings contain characters; NULL contains no value
B
NULL is stored as zero always
C
Blank strings are identical to NULL
D
NULL and blank cannot be distinguished
7

Question 7

You want to record the date of a transaction. Which data type is designed for this purpose?

A
DATE
B
VARCHAR
C
INTEGER
D
BOOLEAN
8

Question 8

While analyzing customer records, you notice comparisons involving NULL return unexpected results. Which logical concept explains this?

A
Three-valued logic
B
Binary logic only
C
Forced true/false rules
D
Implicit casting of NULL
9

Question 9

Which statement correctly describes how numeric types behave?

A
They store numerical values with defined precision.
B
They convert everything to text internally.
C
They store only whole numbers always.
D
They ignore decimal places.
10

Question 10

A developer needs to store a true/false flag for whether a feature is enabled. Which type is suited for this binary choice?

A
BOOLEAN
B
DECIMAL
C
VARCHAR
D
DATE
11

Question 11

When checking missing payment dates, why isn’t = NULL a valid condition?

A
NULL comparisons using = never return true
B
Dates cannot be NULL
C
NULL is converted into text automatically
D
Date comparisons cannot use operators
12

Question 12

A column holding temperature as decimal readings accidentally stores some text strings. What issue does this cause?

A
Inconsistent data types break comparisons
B
Text converts to numeric automatically
C
Decimals always override text
D
Text becomes NULL
13

Question 13

If a field must always contain a date, which constraint prevents NULL from being stored?

A
NOT NULL
B
UNIQUE
C
DEFAULT
D
CHECK (date > 0)
14

Question 14

When storing price values, which type avoids storing unnecessary decimal precision?

A
DECIMAL
B
TEXT
C
INTEGER only
D
BOOLEAN
15

Question 15

Why might a birthdate column allow NULL by design?

A
Some users may choose not to provide it
B
Dates must always allow NULL
C
NULL is identical to empty string
D
NULL forces better indexing
16

Question 16

Which statement is true about empty strings?

A
They contain a value and are not the same as NULL
B
They behave exactly like NULL
C
They cannot be inserted
D
They are automatically converted to zero
17

Question 17

Why should dates be stored in proper DATE types instead of text?

A
DATE types allow correct sorting and comparisons
B
Text storage is forbidden
C
Dates cannot contain characters
D
DATE uses more storage intentionally
18

Question 18

A NULL combined with arithmetic, such as price + NULL, results in:

A
NULL
B
0
C
Price multiplied automatically
D
Empty string
19

Question 19

Which type is most appropriate for storing a yes/no preference?

A
BOOLEAN
B
INTEGER always
C
DATE
D
TEXT
20

Question 20

In a report, comparing city = NULL returns no matches. What's the proper reasoning?

A
NULL cannot be matched with standard operators
B
City values cannot be NULL
C
The comparison must use LIKE instead
D
City is treated as numeric
21

Question 21

A column storing ratings from 1–5 should use which type?

A
INTEGER
B
TEXT
C
DATE
D
BOOLEAN
22

Question 22

A NULL inside a comparison like amount > NULL returns:

A
Unknown (NULL)
B
True always
C
False always
D
Zero
23

Question 23

Which type stores decimal values with precise formatting, often needed in monetary applications?

A
DECIMAL
B
INTEGER
C
BOOLEAN
D
DATE
24

Question 24

NULL is often used because:

A
It represents unavailable or unknown data
B
It is faster than storing zero
C
It replaces default values
D
It sorts before text in all cases
25

Question 25

A customer record contains an optional middle name. Which condition retrieves rows where no middle name is stored?

sql
SELECT * FROM customers WHERE middle_name IS NULL;
A
Returns customers with missing middle names
B
Returns customers with empty strings
C
Returns all customers
D
Returns none because IS NULL is invalid
26

Question 26

You want to list items that have an unspecified expiration date. What does this query find?

sql
SELECT id FROM items WHERE expires_at IS NULL;
A
Items without expiration dates
B
Expired items only
C
All items with future dates
D
No items
27

Question 27

A user’s age may be missing. What rows match this query?

sql
SELECT * FROM users WHERE age IS NOT NULL;
A
Users with known ages
B
Users with missing ages
C
All users
D
Users with age=0
28

Question 28

What type of values does this query retrieve?

sql
SELECT score FROM results WHERE score > 50;
A
Scores greater than 50 and not NULL
B
Scores equal to NULL
C
NULL scores only
D
Negative scores only
29

Question 29

A table tracks timestamps when tasks finish. What result does this query produce?

sql
SELECT id FROM tasks WHERE finished_at IS NOT NULL;
A
Tasks with recorded completion times
B
Tasks without completion times
C
All tasks
D
Tasks with negative times
30

Question 30

Consider this age filter. Which values qualify?

sql
SELECT * FROM people WHERE age >= 18;
A
Only numeric ages 18 or more
B
NULL ages
C
Text-stored ages
D
All rows automatically
31

Question 31

A department table stores optional manager IDs. What does this query return?

sql
SELECT name FROM departments WHERE manager_id IS NULL;
A
Departments without assigned managers
B
Departments with managers
C
All departments
D
Only departments with numeric IDs
32

Question 32

This query checks product weights. What rows are returned?

sql
SELECT * FROM products WHERE weight IS NULL;
A
Products without weight information
B
Products with zero weight
C
All products
D
Only heavy products
33

Question 33

What does this query filter out?

sql
SELECT name FROM pets WHERE height IS NOT NULL;
A
Pets with recorded heights
B
Pets without heights
C
All pets
D
Pets weighing zero
34

Question 34

Which values survive this filter?

sql
SELECT salary FROM staff WHERE salary < 50000;
A
Salaries below 50k, excluding NULL
B
All salaries including NULL
C
Only salaries equal to zero
D
NULL salaries only
35

Question 35

What rows match the following?

sql
SELECT * FROM logs WHERE message IS NULL;
A
Logs without messages
B
All logs always
C
Only logs with blank messages
D
Logs older than a month
36

Question 36

A movie record may lack a release year. Which rows appear here?

sql
SELECT title FROM movies WHERE release_year IS NULL;
A
Movies with unknown release years
B
Movies released recently
C
All movies
D
Movies with year=0
37

Question 37

Which rows qualify under this numeric test?

sql
SELECT score FROM exams WHERE score BETWEEN 60 AND 100;
A
Scores 60–100 excluding NULL
B
All scores including NULL
C
Only NULL scores
D
Scores below 60
38

Question 38

What does this condition identify?

sql
SELECT * FROM orders WHERE delivered_at IS NOT NULL;
A
Orders that have been delivered
B
Orders awaiting delivery
C
Orders with amount NULL
D
All orders
39

Question 39

Which rows match this comparison?

sql
SELECT id FROM assets WHERE value > 0;
A
Assets with positive values
B
Assets with NULL values
C
All assets
D
Assets with zero only
40

Question 40

What group of rows does this query retrieve?

sql
SELECT * FROM profiles WHERE bio IS NULL;
A
Profiles without bio text
B
Profiles with empty bios only
C
All profiles
D
Profiles with numeric bios

QUIZZES IN SQL Database