Add some 2nf transformations
This commit is contained in:
3
sql/2nf/appearances.sql
Normal file
3
sql/2nf/appearances.sql
Normal file
@@ -0,0 +1,3 @@
|
||||
begin;
|
||||
alter table "appearances" drop column "lgID";
|
||||
commit;
|
||||
21
sql/2nf/appearancespost.sql
Normal file
21
sql/2nf/appearancespost.sql
Normal file
@@ -0,0 +1,21 @@
|
||||
begin;
|
||||
create table if not exists appearancespost (
|
||||
"yearID" numeric,
|
||||
"playerID" text,
|
||||
"teamID" text,
|
||||
primary key("yearID","playerID")
|
||||
);
|
||||
|
||||
insert into appearancespost
|
||||
select distinct yearID, playerID, teamID
|
||||
from battingpost
|
||||
union
|
||||
select distinct yearID, playerID, teamID
|
||||
from pitchingpost;
|
||||
|
||||
alter table "battingpost" drop column "teamID";
|
||||
alter table "battingpost" drop column "lgID";
|
||||
|
||||
alter table "pitchingpost" drop column "teamID";
|
||||
alter table "pitchingpost" drop column "lgID";
|
||||
commit;
|
||||
3
sql/2nf/homegames.sql
Normal file
3
sql/2nf/homegames.sql
Normal file
@@ -0,0 +1,3 @@
|
||||
begin;
|
||||
alter table "homegames" drop column "league.key";
|
||||
commit;
|
||||
3
sql/2nf/salaries.sql
Normal file
3
sql/2nf/salaries.sql
Normal file
@@ -0,0 +1,3 @@
|
||||
begin;
|
||||
alter table "salaries" drop column "lgID";
|
||||
commit;
|
||||
4
sql/2nf/seriespost.sql
Normal file
4
sql/2nf/seriespost.sql
Normal file
@@ -0,0 +1,4 @@
|
||||
begin;
|
||||
alter table "seriespost" drop column "lgIDwinner";
|
||||
alter table "seriespost" drop column "lgIDloser";
|
||||
commit;
|
||||
15
sql/2nf/teamshalfdivision.sql
Normal file
15
sql/2nf/teamshalfdivision.sql
Normal file
@@ -0,0 +1,15 @@
|
||||
begin;
|
||||
create table if not exists "teamshalfdivisions" (
|
||||
"yearID" numeric,
|
||||
"teamID" text,
|
||||
"divID" text,
|
||||
primary key("yearID","teamID")
|
||||
);
|
||||
|
||||
insert into teamshalfdivisions
|
||||
select distinct yearid, teamid, divid
|
||||
from teamshalf;
|
||||
|
||||
alter table teamshalf drop column "lgID";
|
||||
alter table teamshalf drop column "divID";
|
||||
commit;
|
||||
Reference in New Issue
Block a user