
Imported Products
Paulo R. Rodegheri Brazil
Our company's import sector needs a report on the import of products from our Sansul providers.
Your task is to display the name of the products, the name of the supplier and the name of the category, for the products supplied by the supplier 'Sansul SA' and whose category name is 'Imported'.
Schema
Column | Type |
id (PK) | numeric |
name | character varying (255) |
amount | numeric |
price | numeric |
id_providers (FK) | numeric |
id_categories (FK) | numeric |
Column | Type |
id (PK) | numeric |
name | character varying (255) |
street | character varying (255) |
city | character varying (255) |
state | char (2) |
Column | Type |
id (PK) | numeric |
name | character varying (255) |
Tables
id | name | amount | price | id_providers | id_categories |
1 | Blue Chair | 30 | 300.00 | 5 | 5 |
2 | Red Chair | 50 | 2150.00 | 2 | 1 |
3 | Disney Wardrobe | 400 | 829.50 | 4 | 1 |
4 | Blue Toaster | 20 | 9.90 | 3 | 1 |
5 | TV | 30 | 3000.25 | 2 | 2 |
id | name | street | city | state |
1 | Ajax SA | Rua Presidente Castelo Branco | Porto Alegre | RS |
2 | Sansul SA | Av Brasil | Rio de Janeiro | RJ |
3 | South Chairs | Rua do Moinho | Santa Maria | RS |
4 | Elon Electro | Rua Apolo | São Paulo | SP |
5 | Mike Electro | Rua Pedro da Cunha | Curitiba | PR |
id | name |
1 | Super Luxury |
2 | Imported |
3 | Tech |
4 | Vintage |
5 | Supreme |
Output Sample
name | name | name |
TV | Sansul SA | Imported |
N.B.: It's better if you solve this by your own. Thank you!
URI - BEECROWD Online Judge 2618 Solve in SQL:
-- Solved by IntesarSELECT p1.name, p2.name, c.nameFROM products p1, providers p2, categories cWHERE (c.id = p1.id_categories AND p1.id_providers = p2.id) AND p2.name = 'Sansul SA' AND c.name = 'Imported';
0 Comments