Kaigai Blog living abroad in my twenties

【My Study Note】Adding, Updating, Deleting Data

MySQL Programming

Adding, Updating, Deleting Data

Insert

Insert INTO students (name, course) 
Values ("Kate", "Java");

AUTO INCREMENT

In most cases, the id column uses the AUTO_INCREMENT feature. When a new record is inserted into a table, AUTO_INCREMENT allows unique values to be automatically generated.

When inserting the data into the table, “id” and “auto increment” can be left out (since computer already knows how it should be from the setting).

Update

UPDATE students
SET name = "Jourdan", course = "HTML"
WHERE id = 6;

Be careful

Don’t forget to use “Where” as well, because if you didn’t, it would update everything since they don’t know where to update.

Delete

DELETE FROM students
WHERE id = 7;