Page 299 - Trackpad 402_Class-X_Final
P. 299

To display records of students whose fees is more than 8500.

            SELECT * FROM Student WHERE FEES>8500;
            +--------+---------------+------+------------+-------+----------+
            | RollNo | Name          | Fees | DOB        | Marks | ClassSec |
            +--------+---------------+------+------------+-------+----------+
            |     35 | Sikha Arora   | 8800 | 2004-12-15 |    87 | 5        |
            |      8 | Aparna Aneja  | 9000 | 2006-09-24 |    92 | 6        |
            |     12 | Debrath Singh | 8600 | 2010-10-27 |    80 | 10A      |

            +--------+---------------+------+------------+-------+----------+
            To display rollno and names  of students whose rollno is 14 and fees is more than 5000.

            SELECT ROLLNO,NAME
            FROM STUDENT
            WHERE ROLLNO=14 AND FEES>5000;
            +--------+-------------+
            | ROLLNO | NAME        |
            +--------+-------------+
            |     14 | Jaya Kapoor |
            +--------+-------------+
            To display the Rollno, name and DOB of students whose marks are in the range of 80 and 90.

            SELECT ROLLNO,NAME,DOB FROM student WHERE MARKS>=80 AND MARKS<=90;
            OR
            SELECT ROLLNO,NAME,DOB FROM student WHERE MARKS BETWEEN 80 AND 90;
            +--------+---------------+------------+
            | ROLLNO | NAME          | DOB        |
            +--------+---------------+------------+
            |     35 | Sikha Arora   | 2004-12-15 |
            |     12 | Debrath Singh | 2010-10-27 |
            +--------+---------------+------------+
            The syntax for modifying the existing content of the table is as follows:

            UPDATE <Table Name>
            SET <Col1>=<Value1> [,<Col2>=<Value2>,... <Col N>=<Value N>]
            [WHERE <Condition>];
            For examples,
            UPDATE STUDENT SET MARKS=92 WHERE CLASSSEC='10A' ;

            UPDATE STUDENT SET CLASSSEC='11C' WHERE NAME='JAYA KAPOOR';
            UPDATE STUDENT SET CLASSSEC='9D' WHERE ROLLNO=35;
            UPDATE STUDENT SET CLASSSEC='10A' WHERE FEES=9000;
            SELECT * FROM STUDENT;









                                                                                   Database  Management System  299
   294   295   296   297   298   299   300   301   302   303   304