aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean <sb.groenenboom@student.avans.nl>2023-03-24 10:45:53 +0100
committerSean <sb.groenenboom@student.avans.nl>2023-03-24 10:45:53 +0100
commit00ba27d694948c9dc4b1dc77311cc214f4e30751 (patch)
tree9d9303d3a6aa43935ef5f174dd2f474f0fd441ea
parent5b77503edf15972e146f5afc518de194dad7f42d (diff)
Added views.sql
-rw-r--r--dbinit/makefile4
-rw-r--r--dbinit/procedures.sql0
-rw-r--r--dbinit/views.sql28
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`)));