Appearance
Data Manipulation Language (DML)
INSERT
With INSERT you can add data into a table
sql
INSERT INTO testtable (col1, col2, col3)
VALUES (1,'a','b'), (2,'c','d');UPDATE
UPDATE updates the matcing rows
sql
UPDATE grades SET grade = 5 WHERE coursename = 'Databases and SQL';WARNING
Without WHERE the UPDATE matches every row in table and will update every row
DELETE
Deletes matching row from a table
sql
DELETE FROM grades WHERE grade = 0;WARNING
Without SELECT the DELETE matches every row in table and will delete everything
Exercises
- Create and drop databases and tables
- Copy tables
- Modify table structures
- Practice INSERT, UPDATE, DELETE safely