SQL Quest › SQL 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". Free accounts get 10 free challenge solves, and this can be one of them.

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

Read the concept: Learn SQL for beginners

Related questions

Department Leaderboard (Multi-Key Sort)Easy · FreePassengers Without Mr. or Mrs. (NOT LIKE)Easy · FreeTop 5 EarnersEasy · FreePromote Your Best CustomersEasy · FreeDelete the Empty AccountsEasy · FreeTop 10 Banks by AssetsEasy · 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