Categories
Paulo R. Rodegheri
Brazil
When the data were migrated to the database, there was a small misunderstanding on the DBA.
Your boss needs you to select the ID and the name of the products, whose categorie name start with 'super'.
Schema
| Column | Type |
| id (PK) | numeric |
| name | varchar |
| amount | numeric |
| price | numeric |
| id_categories (FK) | numeric |
| Column | Type |
| id (PK) | numeric |
| name | varchar |
Tables
| id | name | amount | price | id_categories |
| 1 | Lampshade | 100 | 800 | 4 |
| 2 | Table for painting | 1000 | 560 | 9 |
| 3 | Notebook desk | 10000 | 25.50 | 9 |
| 4 | Computer desk | 350 | 320.50 | 6 |
| 5 | Chair | 3000 | 210.64 | 9 |
| 6 | Home alarm | 750 | 460 | 4 |
| id | name |
| 1 | old stock |
| 2 | new stock |
| 3 | modern |
| 4 | commercial |
| 5 | recyclable |
| 6 | executive |
| 7 | superior |
| 8 | wood |
| 9 | super luxury |
| 10 | vintage |
output Sample
| id | name |
| 2 | Table for painting |
| 3 | Notebook desk |
| 5 | Chair |
N.B.: It's better if you solve this by your own. Thank you!
URI - BEECROWD Online Judge 2606 Solve in SQL:
-- Solved by IntesarSELECT p.id, p.nameFROM products p,categories cWHERE c.name LIKE 'super%' AND c.id = p.id_categories
0 Comments