Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in /home/lsp4you/public_html/connect.php on line 2 LSP4YOU - Learner's Support Publications

Record Insertion

Q:3
Insert data in the fields RollNo, Name, Batch, and Total. (at least 6 records)


SQL> INSERT INTO STUDENT VALUES(&ROLLNO,'&NAME','&BRANCH',&TOTAL);
Enter value for rollno: 201
Enter value for name: JOHN
Enter value for branch: COMMERCE
Enter value for total: 300
old   1: INSERT INTO STUDENT VALUES(&ROLLNO,'&NAME','&BRANCH',&TOTAL)
new   1: INSERT INTO STUDENT VALUES(201,'JOHN','COMMERCE',300)

1 row created.


SQL> /
Enter value for rollno: 202
Enter value for name: BABU
Enter value for branch: SCIENCE
Enter value for total: 200
old   1: INSERT INTO STUDENT VALUES(&ROLLNO,'&NAME','&BRANCH',&TOTAL)
new   1: INSERT INTO STUDENT VALUES(202,'BABU','SCIENCE',200)

1 row created.


SQL> /
Enter value for rollno: 203
Enter value for name: GEORGE
Enter value for branch: COMPUTER
Enter value for total: 500
old   1: INSERT INTO STUDENT VALUES(&ROLLNO,'&NAME','&BRANCH',&TOTAL)
new   1: INSERT INTO STUDENT VALUES(203,'GEORGE','COMPUTER',500)
INSERT INTO STUDENT VALUES(203,'GEORGE','COMPUTER',500)
*
ERROR at line 1:
ORA-02290: check constraint (SCOTT.SYS_C003040) violated


SQL> /
Enter value for rollno: 203
Enter value for name: GEORGE
Enter value for branch: HUMANITIES
Enter value for total: 500
old   1: INSERT INTO STUDENT VALUES(&ROLLNO,'&NAME','&BRANCH',&TOTAL)
new   1: INSERT INTO STUDENT VALUES(203,'GEORGE','HUMANITIES',500)

1 row created.

SQL> /
Enter value for rollno: 204
Enter value for name: JIBIN
Enter value for branch: COMMERCE
Enter value for total: 400
old   1: INSERT INTO STUDENT VALUES(&ROLLNO,'&NAME','&BRANCH',&TOTAL)
new   1: INSERT INTO STUDENT VALUES(204,'JIBIN','COMMERCE',400)

1 row created.


SQL> /
Enter value for rollno: 205
Enter value for name: VARGHESE
Enter value for branch: SCIENCE
Enter value for total: 250
old   1: INSERT INTO STUDENT VALUES(&ROLLNO,'&NAME','&BRANCH',&TOTAL)
new   1: INSERT INTO STUDENT VALUES(205,'VARGHESE','SCIENCE',250)

1 row created.

SQL> /
Enter value for rollno: 206
Enter value for name: SOMAN
Enter value for branch: HUMANITIES
Enter value for total: 420
old   1: INSERT INTO STUDENT VALUES(&ROLLNO,'&NAME','&BRANCH',&TOTAL)
new   1: INSERT INTO STUDENT VALUES(206,'SOMAN','HUMANITIES',420)

1 row created.