Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
SUPERGEEKS-SQL
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Finlay White
SUPERGEEKS-SQL
Commits
9384dc51
Commit
9384dc51
authored
2 years ago
by
Finlay White
Browse files
Options
Downloads
Patches
Plain Diff
volunteeradded added
parent
92160e75
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
createdb.sql
+34
-10
34 additions, 10 deletions
createdb.sql
with
34 additions
and
10 deletions
createdb.sql
+
34
−
10
View file @
9384dc51
...
...
@@ -21,7 +21,7 @@ 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
,
dayjoined
date
DEFAULT
CURDATE
()
,
parentsID
varchar
(
40
),
groupID
varchar
(
40
),
FOREIGN
KEY
(
parentsID
)
REFERENCES
Parents
(
parentID
)
...
...
@@ -33,14 +33,17 @@ FOREIGN KEY (parentsID) REFERENCES Parents(parentID)
DROP
TABLE
IF
EXISTS
`Volunteers`
;
CREATE
TABLE
`Volunteers`
(
VolunteerID
varchar
(
40
)
not
null
unique
,
primary
key
(
VolunteerID
),
VolunteerCode
int
auto_increment
,
primary
key
(
volunteerCode
,
VolunteerID
),
fname
varchar
(
35
),
lname
varchar
(
35
),
hoursworked
int
(
8
),
hoursworked
int
(
8
)
DEFAULT
0
,
DBSlastchecked
date
,
SGlastchecked
date
,
emergencycontact
varchar
(
20
)
emergencycontact
varchar
(
20
),
email
varchar
(
320
)
);
alter
table
Volunteers
auto_increment
=
1001
;
DROP
TABLE
IF
EXISTS
`Sessions`
;
CREATE
TABLE
`Sessions`
(
sessionID
varchar
(
40
)
not
null
unique
,
...
...
@@ -66,7 +69,7 @@ CREATE TABLE `BadgeAwarded`(
primary
key
(
awardedID
),
awardedto
varchar
(
40
),
awardedby
varchar
(
40
),
Badgeawarded
varchar
(
40
),
Badgeawarded
varchar
(
40
),
dateAwarded
date
,
FOREIGN
KEY
(
awardedto
)
REFERENCES
Students
(
studentID
),
FOREIGN
KEY
(
awardedby
)
REFERENCES
Volunteers
(
VolunteerID
),
...
...
@@ -115,9 +118,30 @@ BEGIN
(
md5
(
concat
(
email
,
passwerd
)),
fname
,
lname
,
email
,
phonenum
);
END
$$
addParent
DELIMITER
;
call
addParent
(
"jeff"
,
"Jones"
,
"email@realemail.com"
,
"veryStrongPassw0rd"
,
02358254
);
call
addParent
(
"jeff"
,
"Jones"
,
"sdkufhsdkfh@wshfksjdfh.com"
,
"veryStrongPassw0rd"
,
02358254
);
call
addParent
(
"jeff"
,
"Jones"
,
"email@realemail.com"
,
"veryStrongPassw0rd"
,
02358254
);
call
addParent
(
"jeff"
,
"Jones"
,
"email@realemail.com"
,
"veryStrongPassw0rd"
,
02358254
);
drop
procedure
if
exists
addVolunteer
;
delimiter
$$
CREATE
PROCEDURE
addVolunteer
(
IN
fname
varchar
(
35
),
IN
lname
varchar
(
35
),
IN
email
varchar
(
320
),
IN
passwerd
varchar
(
70
),
IN
phonenum
int
(
10
))
BEGIN
DECLARE
EXIT
HANDLER
FOR
1062
BEGIN
SELECT
'User already exists'
as
ERROR
;
END
;
INSERT
INTO
Volunteers
(
VolunteerID
,
fname
,
lname
,
email
,
emergencycontact
)
values
(
md5
(
concat
(
email
,
passwerd
)),
fname
,
lname
,
email
,
phonenum
);
END
$$
addParent
DELIMITER
;
call
addVolunteer
(
"jeff"
,
"Jones"
,
"email@realemail.com"
,
"veryStrongPassw0rd"
,
02358254
);
call
addVolunteer
(
"jeff"
,
"Jones"
,
"sdkufhsdkfh@wshfksjdfh.com"
,
"veryStrongPassw0rd"
,
02358254
);
call
addVolunteer
(
"jeff"
,
"Jones"
,
"email@realemfvail.com"
,
"veryStrongPassw0rd"
,
02358254
);
call
addVolunteer
(
"jeff"
,
"Jones"
,
"esmail@realemail.com"
,
"veryStrongPassw0rd"
,
02358254
);
select
*
from
parents
;
\ No newline at end of file
select
*
from
volunteers
;
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment