From 1068e7236af8a962bad3e40e70a6057a18448007 Mon Sep 17 00:00:00 2001
From: Finlay White <whitef6@cardiff.ac.uk>
Date: Tue, 4 Apr 2023 15:59:08 +0100
Subject: [PATCH] badges added

---
 createdb.sql | 66 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 66 insertions(+)
 create mode 100644 createdb.sql

diff --git a/createdb.sql b/createdb.sql
new file mode 100644
index 0000000..a214ea0
--- /dev/null
+++ b/createdb.sql
@@ -0,0 +1,66 @@
+DROP SCHEMA IF EXISTS `SuperGeeks`;
+CREATE SCHEMA `SuperGeeks`;
+USE `SuperGeeks`; 
+DROP TABLE IF EXISTS `Parents`;
+CREATE TABLE `Parents`(
+parentID int(20) not null,
+primary key (parentID),
+fname varchar(35),
+lname varchar(35),
+email varchar(320),
+-- maximum size of an email address should be able to store absolutely all possible email addresses
+-- unable to view payment info from any select functions it is also encrypted for customer safety
+paymentinfo varchar(50),
+subscribed bool,
+phonenum int);
+DROP TABLE IF EXISTS `Students`;
+CREATE TABLE `Students`(
+studentID int primary key,
+fname varchar(35),
+lname varchar(35),
+-- The UK Government Data Standards Catalogue reccomends 35 characters for each the first name and last name
+bday date,
+dayjoined date  ,
+parentsID int(20),
+FOREIGN KEY (parentsID) REFERENCES Parents(parentID)
+-- parent ID is stored in student rather than the parents table so that one parent can have many children
+-- and not one child can have many parents. A child may have multiple parents irl but they would share an 
+-- account 
+);
+
+DROP TABLE IF EXISTS `Volunteers`;
+CREATE TABLE `Volunteers`(
+	VolunteerID int(20),
+    primary key(VolunteerID),
+    fname varchar(35),
+    lname varchar(35),
+    hoursworked int(8),
+    DBSlastchecked date,
+    SGlastchecked date,
+    emergencycontact varchar(20)
+	);
+DROP TABLE IF EXISTS `Session`;
+CREATE TABLE `Session`(
+	sessionID int(20),
+    primary key (sessionID),
+    leaderID int(20),
+    location varchar(55),
+    duration int(10),
+    FOREIGN KEY (leaderID) REFERENCES Volunteers(VolunteerID),
+    maxAttendees int(10),
+    Nohelpers int(10));
+DROP TABLE IF EXISTS `Badge`;
+CREATE TABLE `Badge`(
+	BadgeID int(20),
+    badgeName varchar(35),
+    requirementID int(20)
+    );
+DROP TABLE IF EXISTS `BadgeAwarded`;
+CREATE TABLE `BadgeAwarded`(
+	studentID int(20),
+    awardedby int(20),
+    BadgeID   int(20),
+    dateAwarded date
+    );
+    
+    select * from Session;
\ No newline at end of file
-- 
GitLab