In this post we will cover the rest of the CRUD operations with MySQL like:

  • insert
  • delete
  • update

SQL insert into

Inserting new rows in MySQL can be done by:

INSERT INTO customers (`company`, `last_name`, `first_name`, `job_title`, `business_phone`, `fax_number`, `address`, `city`, `state_province`, `zip_postal_code`, `country_region`, `web_page`, `notes`) 
VALUES ('Company A', 'Bedecs', 'Anna', 'Owner', '(123)555-0100', '(123)555-0101', '123 1st Street', 'Seattle', 'WA', '99999', 'USA', NULL, NULL);

SQL update record

When you need to update only one record or mulitple record values:

UPDATE customers
SET first_name = 'Anna'
WHERE id = 1;

UPDATE customers
SET job_title='New Owner'
WHERE job_title='Owner';

SQL delete record

Deleting rows from a table in MySQL:

DELETE FROM customer
WHERE id = 32;

DELETE FROM customer
WHERE id > 32;