Chapter 4: Inserting, Updating and Deleting Data
In the previous two chapters, we learned to create, alter and drop our databases and tables. In this chapter, we’ll learn to insert data into our tables. We’ll also learn to update and delete data.
Inserting Data
To insert data into MySQL, we use the following syntax:
INSERT INTO table_name (column1, column2, column3, …)
VALUES (value1, value2, value3, …);
Suppose we want to insert the information above into the employees table, we write
INSERT INTO employees (em_name, gender, contact_number, salary, years_in_company) VALUES
('James Lee', 'M', '516-514-6568', 3500, 11),
('Peter Pasternak', ...
Get Learn SQL using MySQL in One Day and Learn It Well now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.