diff options
-rw-r--r-- | dbinit/makefile | 4 | ||||
-rw-r--r-- | dbinit/procedures.sql | 0 | ||||
-rw-r--r-- | dbinit/views.sql | 28 |
3 files changed, 30 insertions, 2 deletions
diff --git a/dbinit/makefile b/dbinit/makefile index 0e335b7..bd24efd 100644 --- a/dbinit/makefile +++ b/dbinit/makefile @@ -3,7 +3,7 @@ USER = $(shell id -un) HOST = localhost .PHONY: clean permissions init data procedures full - +all:full.sql # delete old tables and create new tables init: base.sql $(SQL) < $< @@ -23,7 +23,7 @@ full: full.sql base.sql: reset.sql init.sql cat $^ > $@ -full.sql: reset.sql init.sql data.sql procedures.sql +full.sql: reset.sql init.sql demo.sql views.sql procedures.sql cat $^ > $@ data.sql: diff --git a/dbinit/procedures.sql b/dbinit/procedures.sql new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/dbinit/procedures.sql diff --git a/dbinit/views.sql b/dbinit/views.sql new file mode 100644 index 0000000..fe22fdb --- /dev/null +++ b/dbinit/views.sql @@ -0,0 +1,28 @@ +CREATE +VIEW `formula1`.`vwcalendar` AS +SELECT + `calendar`.`year` AS `year`, + `racedate`.`week` AS `week`, + `racedate`.`date` AS `date`, + `circuit`.`name` AS `name` +FROM + (((`calendar` + JOIN `racedate` ON ((`calendar`.`ID` = `racedate`.`calanderID`))) + JOIN `racedatecircuit` ON ((`racedate`.`ID` = `racedatecircuit`.`raceDateID`))) + JOIN `circuit` ON ((`racedatecircuit`.`circuitID` = `circuit`.`ID`))); + + +CREATE +VIEW `formula1`.`vwteamcoureurs` AS +SELECT + `calendar`.`ID` AS `ID`, + `teams`.`teamNumber` AS `teamNumber`, + `teams`.`teamName` AS `teamName`, + `member`.`firstName` AS `firstName`, + `member`.`middleName` AS `middleName`, + `member`.`lastName` AS `lastName` +FROM + (((`calander` + JOIN `teams` ON ((`calendar`.`ID` = `teams`.`calanderID`))) + JOIN `teamsmember` ON ((`teams`.`ID` = `teamsmember`.`teamsID`))) + JOIN `member` ON ((`teamsmember`.`memberID` = `member`.`ID`))); |