How to insert records in the table?
Once the structure of the table is ready, now we can insert records to the table.
To insert the records, you have to use the SQL statement, INSERT INTO
with following Syntax
Syntax
INSERT INTO tablename VALUES(value1, value2, value3…);
Remember that,
üWhile passing string and date kind of data, enclose that data in single quote
üDefault date format of MySQL is yyyy-mm-dd
Example
USE demodb;
INSERT INTO book VALUES(101,
'Data Analytics for Beginners','Rohit Kumar',400);
INSERT INTO book VALUES(102,
'Data Analytics for Professional','Sanjay Sharma',500);
INSERT INTO book VALUES(103,
'Business Analytics for All','Neeraj Verma',500);
INSERT INTO book VALUES(104,
'SQL Programming','Dr B P Sharma',700);
INSERT INTO book VALUES(105,
'Python Programming','Dr B P Sharma',900);
INSERT INTO student
VALUES(1234,'Harish Kumar','harish@gmail.com','9899999999',89000);
INSERT INTO student VALUES(1235,'Kapil
Sharma','kapil@yahoo.co.in','9888888888',45000);
INSERT INTO student
VALUES(1236,'Nitin Verma','nitin@hotmail.com','9877777777',90000);
INSERT INTO student
VALUES(1237,'Ritesh Khanna','ritesh@gmail.com','9866666666',32000);
INSERT INTO student
VALUES(1238,'Tarun Kumar','tarun@outlook.com','9855555555',56000);
INSERT INTO IssueBooks
VALUES(101,1234,'2023-11-12');
INSERT INTO IssueBooks
VALUES(102,1235,'2023-11-16');
INSERT INTO IssueBooks
VALUES(103,1236,'2023-11-20');
Comments
Post a Comment