Page 298 - Trackpad 402_Class-X_Final
P. 298
The syntax to delete a table (data as well as the structure) is as follows:
DROP TABLE <Table Name>;
For example,
DROP TABLE Student;
DML (Data Manipulation Language)
DML is a language that enables users to access or manipulate data. By data manipulation, we mean:
• The retrieval of information stored in the table, using SELECT
• The insertion of new row with information into the table, using INSERT
• The deletion of information from the table (not deleting the column), using DELETE
• The modification of information stored in the table (not modifying the data type of column), using UPDATE
The syntax for inserting a new record in the table is as follows:
INSERT INTO <Table Name> [(<Col1>,<Col2>,... <Col N>)]
VALUES ((<Col1 Value>,<Col2 Value>,... <Col N Value>);
For example,
INSERT INTO student VALUES (14,'Jaya Kapoor',7800,'2008-03-08',78, 9);
INSERT INTO student VALUES (35,'Sikha Arora',8800,'2004-12-15',87, 5);
INSERT INTO student VALUES (8,'Aparna Aneja',9000,'2006-09-24',92, 6);
INSERT INTO Student VALUES (12,'Debrath Singh',8600,'2010-10-27',80,'10A');
The syntax for displaying the content from a table is as follows:
SELECT */<Col1>,<Col2>, ... <Col N>
FROM <Table Name>
WHERE <Condition>;
To display all rows and all columns from the table student:
SELECT * FROM Student;
+--------+---------------+------+------------+-------+----------+
| RollNo | Name | Fees | DOB | Marks | ClassSec |
+--------+---------------+------+------------+-------+----------+
| 14 | Jaya Kapoor | 7800 | 2008-03-08 | 78 | 9 |
| 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 only Rollno and Name with all rows from the table student:
SELECT ROLLNO,NAME FROM Student;
+--------+---------------+
| ROLLNO | NAME |
+--------+---------------+
| 14 | Jaya Kapoor |
| 35 | Sikha Arora |
| 8 | Aparna Aneja |
| 12 | Debrath Singh |
+--------+---------------+
298 Trackpad Information Technology-X

