Page 343 - TP_IT_V1.0_C10_flipbpookl
P. 343

Syntax:

                 SELECT */<Col1>,<Col2>, ... <Col N>
                 FROM <Table Name> ORDER BY <Col1> [ASC/DESC],<Col2> [ASC/DESC],... ;

                 SELECT * FROM STUDENT ORDER BY Name ASC;
                 +--------+---------------+------+------------+-------+----------+
                 | RollNo | Name          | Fees | DOB        | Marks | ClassSec |
                 +--------+---------------+------+------------+-------+----------+
                 |      8 | Aparna Aneja  | 9000 | 2006-09-24 |    92 | 10A      |
                 |     35 | Sikha Arora   | 8800 | 2004-12-15 |    87 | 9D       |
                 |     12 | Debrath Singh | 8600 | 2010-10-27 |    92 | 10A      |
                 |     14 | Jaya Kapoor   | 7800 | 2008-03-08 |    78 | 11C      |
                 +--------+---------------+------+------------+-------+----------+

                 SELECT * FROM Student ORDER BY Fees DESC;
                 +--------+---------------+------+------------+-------+----------+
                 | RollNo | Name          | Fees | DOB        | Marks | ClassSec |
                 +--------+---------------+------+------------+-------+----------+
                 |      8 | Aparna Aneja  | 9000 | 2006-09-24 |    92 | 10A      |
                 |     35 | Sikha Arora   | 8800 | 2004-12-15 |    87 | 9D       |
                 |     12 | Debrath Singh | 8600 | 2010-10-27 |    92 | 10A      |
                 |     14 | Jaya Kapoor   | 7800 | 2008-03-08 |    78 | 11C      |
                 +--------+---------------+------+------------+-------+----------+




                                        Consider the following table “ITEM”:
                          uiz Bee
                                                   ITEMNO          NAME            PRICE        QUANTITY
                                                     11            SOAP              34            12
                                                     22           POWDER             85            10
                                                     33         FACE CREAM           80            15
                                                     44          SHAMPOO            120            21
                                                     55         CONDITIONER         200            11

                                        Write SQL queries to do the following:
                                        •   Display the total amount of each item. The amount must be calculated as the price.
                                           multiplied by quantity for each item.
                                        •   Display the details of items whose price is less than 50.
                                        •   Display the name of items and its price in ascending order.
                                        •   Display the details of all items whose name start with ‘S’.









                                      Is ‘NOSQL’ used for in structured data?



                                                                        Database Management System using LibreOffice Base  341
   338   339   340   341   342   343   344   345   346   347   348