INSERT single row for the TABLE
INSERT INTO employees
VALUES (1,"Neo", "xd", 24.30, "2024-07-04");
INSERT multiple rows at once
INSERT INTO employees
VALUES
(2, "Anuja","Indusara",12.98,"2023-01-02"),
(3,"patrick","star",12.50,"2023-04-01"),
(4,"charana","nilupul",67.98,"2025-08-23"),
(5,"Manuja","Kariyaperuma",45.90,"2021-09-30");
INSERT data into table by omitting certain columns
If we need to add data into table without certain data, as an example if we want to add employee without hourly pay, u cant do that directly like this
INSERT INTO employees
VALUES (1,"Neo", "xd", "2024-07-04");
it will give u and error msg when u execute that command.
Error Code: 1136. Column count doesn't match value count at row 1
To insert data into a table while omitting certain columns, use parentheses after the table name and list only the columns where you want to insert data, like this:
INSERT INTO employees(employee_id,first_name,last_name,hire_date)
VALUES (6,"Dilshan", "xd", "2024-07-04");
SELECT * FROM employees;