The INSERT explanation enables you to add information to your database tables. The linguistic structure goes this way:
Supplement INTO table_name (col_1, col_2, col_3….) Qualities (value_1, value_2, value_3….);
This supplements information into one line. The request of the qualities furnished must relate with the segments that the qualities are to be embedded into.
In the event that you are embeddings information into all sections, you can overlook the segment names and simply do this:
Supplement INTO table_name VALUES (value_1, value_2, value_3);
To populate different columns, utilize a comma to isolate each line, this way:
Qualities
INSERT INTO `table_name`(column_1,column_2,...) VALUES (value_1,value_2,...); (value_1, value_2, value_3….), (value_1, value_2, value_3….), (value_1, value_2, value_3….), (value_1, value_2, value_3….);
The above model populates 4 pushes and accept there are 3 sections in each column.
Suppose that we have the following list of new library members that need to be added into the database.
Execute the accompanying SQL content against the FruitShop database:
(1,'Piece','2015-02-15 10:30:00','2015-02-15 10:30:00'), (2,'Kilogram','2015-02-15 10:30:00','2015-02-15 10:30:00'), (3,'Gram','2015-02-15 10:30:00','2015-02-15 10:30:00'), (4,'Pound','2015-02-15 10:30:00','2015-02-15 10:30:00'), (5,'Ounce','2015-02-15 10:30:00','2015-02-15 10:30:00'), (6,'Bunch','2015-02-15 10:30:00','2015-02-15 10:30:00'), (7,'Container','2015-02-15 10:30:00','2015-02-15 10:30:00');
Addition INTO Fruit
Qualities
(1,'Apple',10,1,'2015-02-15 10:30:00','2015-02-15 10:30:00'), (2,'Orange',5,2,'2015-02-15 10:30:00','2015-02-15 10:30:00'), (3,'Banana',20,6,'2015-02-15 10:30:00','2015-02-15 10:30:00'), (4,'Watermelon',10,1,'2015-02-15 10:30:00','2015-02-15 10:30:00'), (5,'Grapes',15,6,'2015-02-15 10:30:00','2015-02-15 10:30:00'), (6,'Strawberry',12,7,'2015-02-15 10:30:00','2015-02-15 10:30:00');
You can watch that your information was embedded by executing the accompanying SQL explanations.
Check the Fruit Table
Select all records from the Fruit table by running the accompanying explanation:
select * from Fruit
The Result
The outcome should resemble this.
Check the Units Table
Select all records from the Units table by running the accompanying explanation:
select * from Units
The Result
The outcome should resemble this.
We simply utilized a SELECT explanation to question the information in our database. How about we look all the more carefully at MySQL inquiries.
Very affordable projects!! And that to submit before deadlines. Thanks for helping me in my database project and raising my grades. I have been able to secure good marks in my internal assessment only because of you. Read More
Follow Us