Adjust for 2nf
This commit is contained in:
15
sql/2nf/allstargames.sql
Normal file
15
sql/2nf/allstargames.sql
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
begin;
|
||||||
|
create table if not exists allstargames (
|
||||||
|
"gameID" text,
|
||||||
|
"yearID" numeric,
|
||||||
|
"gameNum" numeric,
|
||||||
|
primary key("gameID")
|
||||||
|
);
|
||||||
|
|
||||||
|
insert into allstargames
|
||||||
|
select distinct gameid, yearid, gamenum
|
||||||
|
from allstarfull;
|
||||||
|
|
||||||
|
alter table allstarfull drop column "yearID";
|
||||||
|
alter table allstarfull drop column "gameNum";
|
||||||
|
commit;
|
||||||
@@ -8,7 +8,7 @@ CREATE TABLE "pk_allstarfull" (
|
|||||||
"lgID" NUMERIC,
|
"lgID" NUMERIC,
|
||||||
"GP" NUMERIC,
|
"GP" NUMERIC,
|
||||||
"startingPos" NUMERIC,
|
"startingPos" NUMERIC,
|
||||||
primary key("playerID","yearID","gameNum","startingPos"),
|
primary key("playerID","gameID","startingPos"),
|
||||||
foreign key("playerID") references "people"("playerID")
|
foreign key("playerID") references "people"("playerID")
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user