Updating data

Student table:

UPDATE student_tbl
SET home_address = '234 Park Avenue', contact_number = '23445555567'
WHERE ID = 3

Update multiple students info

Let’s suppose that the college’s engineering department has moved their classes to a new location on campus called the Harper Building. And I need to update the department’s address on the table for all engineering students.

UPDATE student_tbl
SET college_address = 'Harper Building'
WHERE department = 'engineering'
UPDATE student_tbl
SET college_address = 'Harper Building', home_address = 'xyz'
WHERE department = 'engineering'

Deleting data

DELETE FROM student_tbl
WHERE last_name = 'Millar'
DELETE FROM student_tbl
WHERE department = 'engineering'

Deletes all that have engineering.

DELETE FROM student_tbl

Deletes all records.


Additional resources

Here is a list of resources that may be helpful as you continue to explore database engineering :


DatabaseDataSQLSyntaxCRUDQuery

Previous one → 5.Create and read | Next one → 7.SQL operators