SQL QuestSQL Interview Questions › Querying Basics

Insert a New Customer

EasyFreeQuerying Basics

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_idnameemailsignup_datemembershiptotal_orders
1John Smithjohn.smith@email.com2023-01-15Gold15
2Emma Wilsonemma.wilson@email.com2023-03-20Silver8
3Michael Brownmichael.brown@email.com2023-02-10Gold12

Expected output: 3 rows — ids 15, 16, and your new 17

Hint

The hint for this one spells out most of the query, so it stays in the editor. Reach for INSERT, DML, and open the hint there if you stall.

Concepts

INSERT DML

Practise the topic: SQL practice questions

Related questions

Your First QueryEasy · FreePick Your ColumnsEasy · FreeFilter with WHEREEasy · FreeComparison OperatorsEasy · FreeMultiple Conditions (AND / OR)Easy · FreeThe IN OperatorEasy · Free

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