Advertisements
Advertisements
प्रश्न
In a database there are two tables - 'Brand' and 'Item' as shown below:
BRAND:
| ICODE | BNAME |
|---|---|
| 100 | SONY |
| 200 | HP |
| 300 | LG |
| 400 | SAMSUNG |
ITEM:
| ICODE | INAME | PRICE |
|---|---|---|
| 100 | TELEVISION | 25000 |
| 200 | COMPUTER | 30000 |
| 300 | REFRIGERATOR | 23000 |
| 400 | CELL PHONE | 40000 |
Write MYSQL queries for the following:
- To display Iname, price and corresponding Brand name (Bname) of those items, whose price is between 25000 and 30000 both values inclusive).
- To display ICode, Price and BName of the item, which has IName as "Television".
- To increase the Prices of all items by Rs. 10%.
कोड लेखन
Advertisements
उत्तर
-
Items priced between 25000 and 30000, inclusive SELECT i.Iname, i.Price, b.Bname FROM Item AS i JOIN Brand AS b ON i.ICode = b.ICode WHERE i.Price BETWEEN 25000 AND 30000; -
Details of Television SELECT i.ICode, i.Price, b.BName FROM Item AS i JOIN Brand AS b ON i.ICode = b.ICode WHERE i.Iname = 'Television'; -
Increase all prices by 10 percent UPDATE Item SET Price = Price * 1.10;
shaalaa.com
या प्रश्नात किंवा उत्तरात काही त्रुटी आहे का?
