Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Alexander Jabbour
356 group 40 project
Commits
8d35a6c4
Commit
8d35a6c4
authored
Dec 22, 2021
by
Richard
Browse files
bug fixes
parent
25d43850
Changes
2
Hide whitespace changes
Inline
Side-by-side
scripts/script1.sql
View file @
8d35a6c4
drop
table
if
exists
education_level
;
drop
table
if
exists
region
;
drop
table
if
exists
studentVle
;
drop
table
if
exists
studentRegistration
;
drop
table
if
exists
studentAssessment
;
...
...
@@ -87,50 +89,50 @@ create table studentVle (
load
data
LOCAL
infile
'/
home/stefan/stefan/3B/356/ece356/
project/data_files/courses.csv'
ignore
into
table
courseOfferings
load
data
LOCAL
infile
'/
Users/rzhang/workspace/356/356-group-40-
project/data_files/courses.csv'
ignore
into
table
courseOfferings
fields
terminated
by
','
enclosed
by
'"'
lines
terminated
by
'
\r\n
'
ignore
1
lines
;
load
data
LOCAL
infile
'/
home/stefan/stefan/3B/356/ece356/
project/data_files/assessments.csv'
ignore
into
table
assessments
load
data
LOCAL
infile
'/
Users/rzhang/workspace/356/356-group-40-
project/data_files/assessments.csv'
ignore
into
table
assessments
fields
terminated
by
','
enclosed
by
'"'
lines
terminated
by
'
\r\n
'
ignore
1
lines
;
load
data
LOCAL
infile
'/
home/stefan/stefan/3B/356/ece356/
project/data_files/vle.csv'
ignore
into
table
vle
load
data
LOCAL
infile
'/
Users/rzhang/workspace/356/356-group-40-
project/data_files/vle.csv'
ignore
into
table
vle
fields
terminated
by
','
enclosed
by
'"'
lines
terminated
by
'
\r\n
'
ignore
1
lines
;
load
data
LOCAL
infile
'/
home/stefan/stefan/3B/356/ece356/
project/data_files/studentInfo.csv'
ignore
into
table
studentInfo
load
data
LOCAL
infile
'/
Users/rzhang/workspace/356/356-group-40-
project/data_files/studentInfo.csv'
ignore
into
table
studentInfo
fields
terminated
by
','
enclosed
by
'"'
lines
terminated
by
'
\r\n
'
ignore
1
lines
;
load
data
LOCAL
infile
'/
home/stefan/stefan/3B/356/ece356/
project/data_files/studentAssessment.csv'
ignore
into
table
studentAssessment
load
data
LOCAL
infile
'/
Users/rzhang/workspace/356/356-group-40-
project/data_files/studentAssessment.csv'
ignore
into
table
studentAssessment
fields
terminated
by
','
enclosed
by
'"'
lines
terminated
by
'
\r\n
'
ignore
1
lines
;
load
data
LOCAL
infile
'/
home/stefan/stefan/3B/356/ece356/
project/data_files/studentRegistration.csv'
ignore
into
table
studentRegistration
load
data
LOCAL
infile
'/
Users/rzhang/workspace/356/356-group-40-
project/data_files/studentRegistration.csv'
ignore
into
table
studentRegistration
fields
terminated
by
','
enclosed
by
'"'
lines
terminated
by
'
\r\n
'
ignore
1
lines
;
load
data
LOCAL
infile
'/
home/stefan/stefan/3B/356/ece356/
project/data_files/studentVle.csv'
ignore
into
table
studentVle
load
data
LOCAL
infile
'/
Users/rzhang/workspace/356/356-group-40-
project/data_files/studentVle.csv'
ignore
into
table
studentVle
fields
terminated
by
','
enclosed
by
'"'
lines
terminated
by
'
\r\n
'
ignore
80
00000
lines
;
ignore
105
00000
lines
;
...
...
scripts/script2.sql
View file @
8d35a6c4
...
...
@@ -19,7 +19,7 @@ ALTER TABLE assessments DROP INDEX fk_courses_assessments;
-- Add new PK column
ALTER
TABLE
courseOfferings
DROP
PRIMARY
KEY
;
ALTER
TABLE
courseOfferings
ADD
course_offering_id
int
auto_incre
6
ment
primary
key
;
ALTER
TABLE
courseOfferings
ADD
course_offering_id
int
auto_increment
primary
key
;
-- ---------
-- TABLE_NAME, CONSTRAINT_TYPE, CONSTRAINT_NAME
...
...
@@ -36,17 +36,16 @@ SET studentVle.course_offering_id = courseOfferings.course_offering_id;
ALTER
TABLE
studentRegistration
ADD
course_offering_id
int
;
ALTER
TABLE
studentRegistration
ADD
CONSTRAINT
fk_courseid_studentRegistration
FOREIGN
KEY
(
course_offering_id
)
REFERENCES
courseOfferings
(
course_offering_id
);
UPDATE
studentRegistration
LEFT
JOIN
courseOfferings
ON
(
studentRegistration
.
code_module
=
courseOfferings
.
code_module
AND
studentRegistration
.
code_presentation
=
courseOfferings
.
code_presentation
)
SET
studentRegistration
.
course_offering_id
=
courseOfferings
.
course_offering_id
;
ALTER
TABLE
studentInfo
ADD
course_offering_id
int
;
ALTER
TABLE
studentInfo
ADD
CONSTRAINT
fk_courseid_studentInfo
FOREIGN
KEY
(
course_offering_id
)
REFERENCES
courseOfferings
(
course_offering_id
);
UPDATE
studentInfo
LEFT
JOIN
courseOfferings
ON
(
studentInfo
.
code_module
=
courseOfferings
.
code_module
AND
studentInfo
.
code_presentation
=
courseOfferings
.
code_presentation
)
SET
studentInfo
.
course_offering_id
=
courseOfferings
.
course_offering_id
;
ALTER
TABLE
vle
ADD
course_offering_id
int
;
ALTER
TABLE
vle
ADD
CONSTRAINT
fk_courseid_vle
FOREIGN
KEY
(
course_offering_id
)
REFERENCES
courseOfferings
(
course_offering_id
);
UPDATE
vle
LEFT
JOIN
courseOfferings
ON
(
vle
.
code_module
=
courseOfferings
.
code_module
AND
vle
.
code_presentation
=
courseOfferings
.
code_presentation
)
SET
vle
.
course_offering_id
=
courseOfferings
.
course_offering_id
;
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment