URI Online Judge Solution 2608 Higher and Lower Price Using PostgreSQL Query Language.
The financial sector of our company, wants to know the smaller and higher values of the products, which we sell.
For this you must display only the highest and lowest price of the products table.
Schema
Column | Type |
id (PK) | numeric |
name | varchar |
amount | numeric |
price | numeric |
Tables
id | name | amount | price |
1 | Two-doors wardrobe | 100 | 800 |
2 | Dining table | 1000 | 560 |
3 | Towel holder | 10000 | 25.50 |
4 | Computer desk | 350 | 320.50 |
5 | Chair | 3000 | 210.64 |
6 | Single bed | 750 | 460 |
Output Sample
price | price |
800 | 25.50 |
URI 2608 Solution in SQL:
SELECT max(Price) price, min(Price) price FROM products
Comments
Post a Comment