Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
3
356 group 40 project
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
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
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
Alexander Jabbour
356 group 40 project
Commits
85b105c2
Commit
85b105c2
authored
3 years ago
by
Richard
Browse files
Options
Downloads
Patches
Plain Diff
studentinfo changes
parent
3778f4db
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
scripts/alter.sql
+22
-0
22 additions, 0 deletions
scripts/alter.sql
with
22 additions
and
0 deletions
scripts/alter.sql
+
22
−
0
View file @
85b105c2
...
...
@@ -102,7 +102,29 @@ ALTER TABLE studentInfo ADD regionid int;
ALTER
TABLE
studentInfo
ADD
CONSTRAINT
fk_regionid_studentInfo
FOREIGN
KEY
(
regionid
)
REFERENCES
region
(
regionid
);
UPDATE
studentInfo
JOIN
region
ON
(
studentInfo
.
region
=
region
.
name
)
SET
studentInfo
.
regionid
=
region
.
regionid
;
ALTER
TABLE
studentInfo
DROP
COLUMN
region
;
-- education to own table
CREATE
TABLE
education_level
(
educationid
int
primary
key
AUTO_INCREMENT
,
highest_level
varchar
(
40
)
);
INSERT
INTO
education_level
(
highest_level
)
SELECT
DISTINCT
highest_education
FROM
studentInfo
;
ALTER
TABLE
studentInfo
ADD
educationid
int
;
ALTER
TABLE
studentInfo
ADD
CONSTRAINT
fk_educationid_studentInfo
FOREIGN
KEY
(
educationid
)
REFERENCES
education_level
(
educationid
);
UPDATE
studentInfo
JOIN
education_level
ON
(
studentInfo
.
highest_education
=
education_level
.
highest_level
)
SET
studentInfo
.
educationid
=
education_level
.
educationid
;
ALTER
TABLE
studentInfo
DROP
COLUMN
highest_education
;
-- gender to enum
ALTER
TABLE
studentInfo
ADD
gender_enum
ENUM
(
'M'
,
'F'
);
UPDATE
studentInfo
SET
gender_enum
=
'M'
WHERE
STRCMP
(
gender
,
'M'
);
UPDATE
studentInfo
SET
gender_enum
=
'F'
WHERE
STRCMP
(
gender
,
'F'
);
ALTER
TABLE
studentInfo
DROP
COLUMN
gender
;
ALTER
TABLE
studentInfo
RENAME
COLUMN
gender_enum
TO
gender
;
-- ===== studentAssessment Changes ===== --
-- new failed boolean column
...
...
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