SQL interview question: INSERT a New Row
Stock a New Product
A merchant just added a mechanical keyboard to their store, and it needs to go into the catalog.
Write a single INSERT statement adding a product with product_id 21, product_name 'Mechanical Keyboard', category 'Electronics', price 89.99, and rating 4.5.
Note: Your change is verified automatically and rolled back afterwards - the database never actually changes.
This challenge changes data. Your statement runs on a private copy of the database, then we check the resulting table.
Tables
products 20 rows
- product_id integer PK
- product_name text
- category text
- price real
- rating real
| product_id | product_name | category | price | rating |
|---|---|---|---|---|
| 1 | MacBook Pro | Electronics | 1999.99 | 4.8 |
| 2 | iPad Air | Electronics | 599.99 | 4.8 |
| 3 | AirPods Pro | Electronics | 249.99 | 4.7 |