Tables, Keys & Constraints · Question 3 · Easy

What does the final SELECT return?

CREATE TABLE Orders (
  id INT PRIMARY KEY,
  item VARCHAR(20),
  status VARCHAR(10) DEFAULT 'NEW'
);
INSERT INTO Orders (id, item) VALUES (1, 'Kurta');
SELECT status FROM Orders WHERE id = 1;
  1. NULL
  2. NEW
  3. Kurta
  4. An empty string
Answer and explanation

Answer: B. NEW

Explanation: The INSERT lists only id and item, so status is not given a value. A column that is left out of an INSERT takes its DEFAULT, which here is NEW.

Previous: What happens when the last statement runs? · Next: What happens when the INSERT runs?

Practise tables, keys & constraints

Try a fresh set of tables, keys & constraints questions with an explanation after every answer, free and without signing up: Tables, Keys & Constraints practice. Or sit a full placement mock test.

More tables, keys & constraints questions

More sql practice

DML & Transactions · SELECT, WHERE & ORDER BY · SQL Joins · Aggregates & GROUP BY · Subqueries & CTEs · Window Functions · NULL Handling · SQL Functions & CASE

LogicWiz Exams home · All practice topics · Placement mock tests · Daily 10 challenge