Commit 57aa0fc8 authored by Daniel Kim's avatar Daniel Kim
Browse files

fixed dead people

parent b183208a
......@@ -88,8 +88,8 @@ create table DeadPeople (
);
alter table DeadPeople add primary key (personID);
alter table DeadPeople add foreign key (personID) references People(personID);
replace into DeadPeople (personID, dateOfDeath, placeOfDeath, reasonOfDeath) select personID, dateOfDeath, placeOfDeath, reasonOfDeath from ImdbNames
where dateOfDeath != null;
replace into DeadPeople (personID, dateOfDeath, placeOfDeath, reasonOfDeath)
select personID, dateOfDeath, placeOfDeath, reasonOfDeath from ImdbNames where dateOfDeath is not null;
create table PeopleInMovies (
movieID char(9) not null,
......@@ -201,7 +201,7 @@ create table Countries (
country varchar(128) not null
);
alter table Countries add primary key (country);
replace into Countries (country) select distinct country from ImdbMovies;
replace into Countries (country) select distinct country from ImdbMovies where country != "";
-- drop table if exists temp;
-- create table temp (val varchar(128));
......@@ -249,7 +249,7 @@ create table CountriesInMovies (
alter table CountriesInMovies add primary key (movieID, country);
alter table CountriesInMovies add foreign key (movieID) references Movies(movieID);
alter table CountriesInMovies add foreign key (country) references Countries(country);
replace into CountriesInMovies (movieID, country) select movieID, country from ImdbMovies;
replace into CountriesInMovies (movieID, country) select movieID, country from ImdbMovies where country != "";
-- drop procedure if exists loadCountry;
-- delimiter ;;
......@@ -292,7 +292,7 @@ create table Languages (
language varchar(128) not null
);
alter table Languages add primary key (language);
replace into Languages (language) select distinct language from ImdbMovies;
replace into Languages (language) select distinct language from ImdbMovies where language != "";
-- drop table if exists temp;
-- create table temp (val varchar(128));
......@@ -339,7 +339,7 @@ create table LanguagesInMovies (
alter table LanguagesInMovies add primary key (movieID, language);
alter table LanguagesInMovies add foreign key (movieID) references Movies(movieID);
alter table LanguagesInMovies add foreign key (language) references Languages(language);
replace into LanguagesInMovies (movieID, language) select movieID, language from ImdbMovies;
replace into LanguagesInMovies (movieID, language) select movieID, language from ImdbMovies where language != "";
-- drop procedure if exists loadLanguage;
-- delimiter ;;
-- create procedure loadLanguage() begin
......@@ -381,7 +381,7 @@ create table ProductionCompany (
productionCompany varchar(128) not null
);
alter table ProductionCompany add primary key (productionCompany);
replace into ProductionCompany (productionCompany) select distinct productionCompany from ImdbMovies;
replace into ProductionCompany (productionCompany) select distinct productionCompany from ImdbMovies where productionCompany != "";
alter table ProductionCompany add index productionCompanyIndex(productionCompany);
create table ProductionCompaniesInMovies (
......@@ -391,7 +391,7 @@ create table ProductionCompaniesInMovies (
alter table ProductionCompaniesInMovies add primary key (movieID, productionCompany);
alter table ProductionCompaniesInMovies add foreign key (movieID) references Movies(movieID);
alter table ProductionCompaniesInMovies add foreign key (productionCompany) references ProductionCompany(productionCompany);
replace into ProductionCompaniesInMovies (movieID, productionCompany) select movieID, productionCompany from ImdbMovies;
replace into ProductionCompaniesInMovies (movieID, productionCompany) select movieID, productionCompany from ImdbMovies where productionCompany != "";
-- max id
create table MaxIDs (
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment