easy · Dialects: PostgreSQL, MySQL
The store is launching a weekend promotion: 10% off all games in the Action genre. Update the catalog prices of those games so that each such price is multiplied by 0.9.
Tables:
- players:
idint 🔑;namevarchar(100);emailvarchar(255);cityvarchar(100);registered_atdate - games:
idint 🔑;titlevarchar(200);genrevarchar(100);pricedecimal(10,2);stockint - orders:
idint 🔑;player_idint → players.id;created_attimestamp;statusvarchar(20) - order_items:
idint 🔑;order_idint → orders.id;game_idint → games.id;quantityint;pricedecimal(10,2)
▶ Solve online with instant checking
easy · Dialects: PostgreSQL, MySQL
To run a scenario across multiple order statuses you need fixture data.
Insert into orders in a single statement three rows for user_id = 1:
| id | status | amount |
|---|---|---|
| 501 | PAID | 100.00 |
| 502 | PENDING | 250.00 |
| 503 | CANCELLED | 75.50 |
created_at = CURRENT_TIMESTAMP.
Tables:
- users:
idint 🔑;emailvarchar(255) - orders:
idint 🔑;user_idint → users.id;statusvarchar(20);amountdecimal(10,2);created_attimestamp
▶ Solve online with instant checking
easy · Dialects: PostgreSQL
Twice a year you do a spring clean of your journal: anything you didn't pin manually counts as noise and goes. From notes delete every row where is_pinned = FALSE. Pinned notes (is_pinned = TRUE) survive.
Tables:
- notes:
idserial 🔑;titlevarchar(120);bodytext;is_pinnedboolean;created_atdate
▶ Solve online with instant checking
easy · Dialects: PostgreSQL
You're building a Notion-style journal app and want to verify that saving a new entry works. Insert one row into notes: put Привет SQL into title and Первая запись через INSERT into body — the journal keeps its notes in Russian, so copy both values exactly as written. Leave id, is_pinned, and created_at alone — they fill in from defaults.
Tables:
- notes:
idserial 🔑;titlevarchar(120);bodytext;is_pinnedboolean;created_atdate
▶ Solve online with instant checking
easy · Dialects: PostgreSQL
For the new year you decided to surface every January note — they turned out to be the most useful of the year. In notes set is_pinned = TRUE for every row whose created_at falls in January 2024 inclusive — both January 1 and January 31 should be included. Leave the rest as they are.
Tables:
- notes:
idserial 🔑;titlevarchar(120);bodytext;is_pinnedboolean;created_atdate
▶ Solve online with instant checking
easy · Dialects: PostgreSQL, MySQL
In the bug-tracker test environment you need to create a QA account.
Insert into users a new row with:
id= 101email=qa.test@example.comrole_id= 1 (tester role)is_active= truecreated_at= current timestamp (CURRENT_TIMESTAMP)
Tables:
- roles:
idint 🔑;namevarchar(50) - users:
idint 🔑;emailvarchar(255);role_idint → roles.id;is_activeboolean;created_attimestamp