diff --git a/Chinook_Rev1.sql b/Chinook_Rev1.sql index 0ac5af5..36a8186 100644 --- a/Chinook_Rev1.sql +++ b/Chinook_Rev1.sql @@ -1,4 +1,4 @@ -USE `Chinook`; +USE `chinook`; /******************************************************************************* @@ -88,6 +88,12 @@ CREATE TABLE `TrackURL` ); +/******************************************************************************* + ALTER TABLES +********************************************************************************/ + +ALTER TABLE customer ADD PersonID INT NOT NULL; +ALTER TABLE employee ADD PersonID INT NOT NULL; /******************************************************************************* Create Primary Key Unique Indexes @@ -107,6 +113,9 @@ ALTER TABLE `CreditCard` ADD CONSTRAINT `FK_CreditCardPayId` CREATE INDEX `IFK_CreditCardPayId` ON `CreditCard` (`PayId`); +ALTER TABLE `Customer` ADD CONSTRAINT `FK_CustomerPersonId` + FOREIGN KEY (`PersonId`) REFERENCES `Person` (`PersonId`) ON DELETE NO ACTION ON UPDATE NO ACTION; + CREATE INDEX `IFK_CustomerPersonId` ON `Customer` (`PersonId`); ALTER TABLE `Employee` ADD CONSTRAINT `FK_EmployeePersonId`