हिंदी

In a database there are two tables - 'Brand' and 'Item' as shown below: BRAND: ICODE 100 200 300 400 BNAME SONY HP LG SAMSUNG ITEM: ICODE 100 200 300 400 INAME TELEVISION COMPUTER REFRIGERATOR CELL

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:

  1. To display Iname, price and corresponding Brand name (Bname) of those items, whose price is between 25000 and 30000 both values inclusive).
  2. To display ICode, Price and BName of the item, which has IName as "Television".
  3. To increase the Prices of all items by Rs. 10%.
कोड लेखन
Advertisements

उत्तर

  1. 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;
  2.  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';
  3. Increase all prices by 10 percent
    UPDATE Item
    SET Price = Price * 1.10;
shaalaa.com
  क्या इस प्रश्न या उत्तर में कोई त्रुटि है?
अध्याय 10: Structure Query Language - EXERCISE [पृष्ठ १९९]

APPEARS IN

सीबीएसई Computer Science with Python [English] Class 12
अध्याय 10 Structure Query Language
EXERCISE | Q 25. | पृष्ठ १९९
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×