Introduction To SQL Part2
Introduction To SQL Part2
“One should look for what is and not what he thinks should be.”
-Albert Einstein.
Warm up
Before we begin, check out this case study of using MySQL in hospitality industry:
https://www.mysql.com/why-mysql/case-studies/hospitality-app-boosts-productivity-hotel-
profits/
Before updating
After updating
DESC faculty;
● After deleting
DELETE FROM course WHERE course_id = 12;
● To remove the table itself from the database, use the DROP TABLE
DROP TABLE faculty; -- child table having course_id as foreign key
DROP TABLE course; -- parent table
● Note: always delete the child table with the foreign key first
● Table faculty has a foreign key from course table, so delete faculty table first
● course table is the referenced table - if we delete course table first, it will throw an error
● Delete faculty table first and then course table