W3. SQL Null Values Flashcards

1
Q

Q: What is a NULL value in SQL?

A

A: A field with no value, meaning it was left blank during record creation.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Q: How is a NULL value different from a zero or a space?

A

A: NULL represents an absence of value, while zero and space are actual values.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Q: How do you test for NULL values in SQL?

A

A: Use the IS NULL or IS NOT NULL operators.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Q: What is the syntax for using the IS NULL operator?

A

SELECT column_names
FROM table_name
WHERE column_name IS NULL;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Q: Write a query to select customers with a NULL value in the “Address” field.

A
SELECT CustomerName, ContactName, Address 
FROM Customers 
WHERE Address IS NULL;
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Q: Why can’t you use = or <> to test for NULL values?

A

A: Because NULL represents an absence of value and cannot be compared directly with comparison operators.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Q: What does the IS NOT NULL operator do?

A

A: It tests for non-empty values, returning records where the specified field is not NULL.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Q: Write a query to select customers with a value in the “Address” field.

A
SELECT CustomerName, ContactName, Address 
FROM Customers 
WHERE Address IS NOT NULL;
How well did you know this?
1
Not at all
2
3
4
5
Perfectly