SQL Quest › SQL Interview Questions › Querying Basics
Insert a New Customer
A new customer signed up and needs to exist in the table before anything else can reference them.
Insert customer_id 17, 'Ada Lovelace', 'ada.lovelace@email.com', signup date '2024-06-01', 'Silver' membership, 0 total_orders — then show customer_id, name, membership for every customer with an id of 15 or higher, ordered by customer_id, so you can see your row landed.
This is the shape of nearly every write you will ever do: change something, then immediately select it back to prove the change is real. INSERT INTO table VALUES (...) supplies values in column order — get the order wrong and SQL will happily put a date in the membership column.
Solve it in the browser editor →
Runs on SQLite in your browser, graded against the expected result, no signup. A wrong answer gets a diagnosis, not just "incorrect".
Schema
customers
| customer_id | name | signup_date | membership | total_orders | |
|---|---|---|---|---|---|
| 1 | John Smith | john.smith@email.com | 2023-01-15 | Gold | 15 |
| 2 | Emma Wilson | emma.wilson@email.com | 2023-03-20 | Silver | 8 |
| 3 | Michael Brown | michael.brown@email.com | 2023-02-10 | Gold | 12 |
Expected output: 3 rows — ids 15, 16, and your new 17
Hint
INSERT, DML, and open the hint there if you stall.Concepts
INSERT DML
Practise the topic: SQL practice questions
Related questions
Where would this cost you points in an interview?
Ten questions, no signup: a Skillmap across nine SQL skills and the one to fix first.
Take the readiness test