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
92160e75
Commit
92160e75
authored
2 years ago
by
Finlay White
Browse files
Options
Downloads
Patches
Plain Diff
added proc
parent
669d65e7
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
+28
-11
28 additions, 11 deletions
createdb.sql
with
28 additions
and
11 deletions
createdb.sql
+
28
−
11
View file @
92160e75
...
...
@@ -7,12 +7,12 @@ parentID varchar(40) not null unique,
primary
key
(
parentID
),
fname
varchar
(
35
),
lname
varchar
(
35
),
email
varchar
(
320
),
email
varchar
(
320
)
unique
,
-- 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
);
phonenum
int
(
10
)
);
DROP
TABLE
IF
EXISTS
`Students`
;
CREATE
TABLE
`Students`
(
studentID
varchar
(
40
)
not
null
unique
,
...
...
@@ -93,14 +93,31 @@ Alter table `Badge`ADD FOREIGN KEY (RequirementID) REFERENCES Badgereqs(Requirem
-- procedures
drop
procedure
if
exists
addParent
;
delimiter
$$
CREATE
PROCEDURE
addParent
(
IN
fname
varchar
(
35
),
IN
lname
varchar
(
35
),
IN
email
varchar
(
320
),
IN
passwerd
varchar
(
70
),
IN
phonenum
int
(
10
))
DELIMITER
^^
-- error handling
CREATE
PROCEDURE
CreateParent
(
IN
accNum
INT
,
IN
firstname
VARCHAR
(
25
),
IN
accBalance
float
)
BEGIN
DECLARE
CONTINUE
HANDLER
FOR
1062
SELECT
'Duplicate account number'
AS
MESSAGE
;
INSERT
INTO
accounts
(
accNo
,
fname
,
balance
)
VALUES
(
accNum
,
firstname
,
accBalance
);
END
^^
DELIMITER
;
BEGIN
DECLARE
EXIT
HANDLER
FOR
1062
BEGIN
SELECT
'User already exists'
as
ERROR
;
END
;
-- if (locate("@",email) = 0
-- Select "invalid email as Error";
INSERT
INTO
Parents
(
parentID
,
fname
,
lname
,
email
,
phonenum
)
values
(
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
);
select
*
from
parents
;
\ 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