|
|
|
@@ -0,0 +1,253 @@
|
|
|
|
|
Script started on Thu Mar 11 17:15:35 2021
|
|
|
|
|
]0;ishoebot@gc112m01:~[ishoebot@gc112m01 ~]$ exitls[Kdwa783987473829y2benjknbfdskbncxknbczx[27Gdwadwan[K[24Gn[Kd``eexit[24Gmysql -u ishoebot -p -h cs1103.cs.unb.ca
|
|
|
|
|
|
|
|
|
|
Enter password:
|
|
|
|
|
(B[0;1mWelcome to the MariaDB monitor. Commands end with ; or \g.
|
|
|
|
|
(B[m(B[0;1mYour MariaDB connection id is 590
|
|
|
|
|
Server version: 5.5.65-MariaDB MariaDB Server
|
|
|
|
|
|
|
|
|
|
(B[m(B[0;1mCopyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
|
|
|
|
|
|
|
|
|
|
(B[m(B[0;1mType 'help;' or '\h' for help. Type '\c' to clear the current input statement.
|
|
|
|
|
|
|
|
|
|
(B[m[?1034hMariaDB [(none)]> uys se ishoebot
|
|
|
|
|
(B[0;1mDatabase changed
|
|
|
|
|
(B[mMariaDB [ishoebot]> CREATE TABLE Students
|
|
|
|
|
-> (
|
|
|
|
|
-> studentID INT AUTO_INCREMENT,
|
|
|
|
|
-> studentName VARCHAR(30) NOT NULL,
|
|
|
|
|
-> email VARCHAR(40),
|
|
|
|
|
-> gpa FLOAT DEFAULT 0.0,
|
|
|
|
|
IMAR -> PRIMARY KEY (studentID)
|
|
|
|
|
-> CONSTRAINT CHECK_GPA
|
|
|
|
|
-> CHECK (gpa BETWEEN 0 and 4.3)
|
|
|
|
|
-> );
|
|
|
|
|
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'CONSTRAINT CHECK_GPA
|
|
|
|
|
CHECK (gpa BETWEEN 0 and 4.3)
|
|
|
|
|
)' at line 8
|
|
|
|
|
(B[0;7m(B[mMariaDB [ishoebot]> CREATE TABLE Students
|
|
|
|
|
-> (
|
|
|
|
|
-> studentID INT AUTO_INCREMENT,
|
|
|
|
|
-> studentName VARCHAR(30) NOT NULL,
|
|
|
|
|
-> email VARCHAR(40),
|
|
|
|
|
-> gpa FLOAT DEFAULT 0.0,
|
|
|
|
|
-> PRIMARY KEY (studentID),
|
|
|
|
|
-> CONSTRAINT CHECK_GPA
|
|
|
|
|
-> CHECK (gpa BETWEEN 0 and 4.3)
|
|
|
|
|
-> );
|
|
|
|
|
(B[0;1mQuery OK, 0 rows affected (0.00 sec)
|
|
|
|
|
(B[m(B[0;1m
|
|
|
|
|
(B[mMariaDB [ishoebot]> ALTER TABLE Students ADD dateOfBirth DATETIME;
|
|
|
|
|
Stage: 2 of 2 'Enabling keys' 0% of stage done
|
|
|
|
|
|
|
|
|
|
(B[0;1mQuery OK, 0 rows affected (0.01 sec)
|
|
|
|
|
(B[m(B[0;1mRecords: 0 Duplicates: 0 Warnings: 0
|
|
|
|
|
(B[m(B[0;1m
|
|
|
|
|
(B[mMariaDB [ishoebot]> CREATE TABLE Enrollments
|
|
|
|
|
-> (
|
|
|
|
|
-> studentID INT,
|
|
|
|
|
-> courseID INT,
|
|
|
|
|
-> letterGrade CHAR(2),
|
|
|
|
|
-> PRIMARY KEY(studentID, courseID),
|
|
|
|
|
-> FOREIGN KEY(studentID)
|
|
|
|
|
-> REFERENCES Students(studentID)
|
|
|
|
|
-> ON DELETE NO ACTION
|
|
|
|
|
-> ON UPDATE CASCADE
|
|
|
|
|
-> );
|
|
|
|
|
(B[0;1mQuery OK, 0 rows affected (0.00 sec)
|
|
|
|
|
(B[m(B[0;1m
|
|
|
|
|
(B[mMariaDB [ishoebot]> CREATE TABLE Courses
|
|
|
|
|
-> (
|
|
|
|
|
-> courseID INT AUTO_INCREMENT,
|
|
|
|
|
-> courseNum VARCHAR(10),
|
|
|
|
|
-> courseName VARCHAR(40),
|
|
|
|
|
-> courseDescription VARCHAR(80),
|
|
|
|
|
creditHours FL -> creditHours FLOAT DEFAULT 3.0,
|
|
|
|
|
-> CHECK (creditHours BETWEEN 0.0 AND 6.0)
|
|
|
|
|
-> PRIMARY KEY(courseID)
|
|
|
|
|
-> );
|
|
|
|
|
[K -> );
|
|
|
|
|
[K -> );
|
|
|
|
|
[K -> );
|
|
|
|
|
[K -> );
|
|
|
|
|
[K -> );
|
|
|
|
|
[K -> );
|
|
|
|
|
[K -> );
|
|
|
|
|
[K -> );
|
|
|
|
|
[K -> );
|
|
|
|
|
[K -> );
|
|
|
|
|
[K -> );
|
|
|
|
|
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'PRIMARY KEY(courseID)
|
|
|
|
|
)' at line 9
|
|
|
|
|
(B[0;7m(B[mMariaDB [ishoebot]> CREATE TABLE Courses
|
|
|
|
|
-> (
|
|
|
|
|
-> courseID INT AUTO_INCREMENT,
|
|
|
|
|
-> courseNum VARCHAR(10),
|
|
|
|
|
-> courseName VARCHAR(40),
|
|
|
|
|
-> courseDescription VARCHAR(80),
|
|
|
|
|
-> creditHours FLOAT DEFAULT 3.0,
|
|
|
|
|
-> CHECK (creditHours BETWEEN 0.0 AND 6.0),
|
|
|
|
|
EY(courseID -> PRIMARY KEY(courseID)
|
|
|
|
|
-> );
|
|
|
|
|
(B[0;1mQuery OK, 0 rows affected (0.01 sec)
|
|
|
|
|
(B[m(B[0;1m
|
|
|
|
|
(B[mMariaDB [ishoebot]> ALTER TABLE Enrollments
|
|
|
|
|
-> (
|
|
|
|
|
-> FOREIGN KEY(courseID)
|
|
|
|
|
FERE -> REFERENCES Courses(courseID)
|
|
|
|
|
-> ON DELETE NO ACTION
|
|
|
|
|
-> ON UPDATE CASCADE
|
|
|
|
|
-> );
|
|
|
|
|
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '(
|
|
|
|
|
FOREIGN KEY(courseID)
|
|
|
|
|
REFERENCES Courses(courseID)
|
|
|
|
|
ON DELETE NO ACTION
|
|
|
|
|
' at line 2
|
|
|
|
|
(B[0;7m(B[mMariaDB [ishoebot]> ALTER TABLE Enrollments
|
|
|
|
|
-> (
|
|
|
|
|
-> ADD FOREIGN KEY(courseID)
|
|
|
|
|
-> REFERENCES Courses(courseID)
|
|
|
|
|
-> ON DELETE NO ACTION
|
|
|
|
|
-> ON UPDATE CASCADE
|
|
|
|
|
-> );
|
|
|
|
|
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '(
|
|
|
|
|
ADD FOREIGN KEY(courseID)
|
|
|
|
|
REFERENCES Courses(courseID)
|
|
|
|
|
ON DELETE NO ACTI' at line 2
|
|
|
|
|
(B[0;7m(B[mMariaDB [ishoebot]> ALTER TABLE Enrollments
|
|
|
|
|
-> FOREIGN KEY(courseID)
|
|
|
|
|
-> REFERENCES Courses(courseID)
|
|
|
|
|
-> ON DELETE NO ACTION
|
|
|
|
|
-> ON UPDATE CASCADE;
|
|
|
|
|
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'FOREIGN KEY(courseID)
|
|
|
|
|
REFERENCES Courses(courseID)
|
|
|
|
|
ON DELETE NO ACTION
|
|
|
|
|
' at line 2
|
|
|
|
|
(B[0;7m(B[mMariaDB [ishoebot]> ALTER TABLE Enrollments
|
|
|
|
|
-> ADD FOREIGN KEY(courseID)
|
|
|
|
|
-> REFERENCES Courses(courseID)
|
|
|
|
|
-> ON DELETE NO ACTION
|
|
|
|
|
-> ON UPDATE CASCADE;
|
|
|
|
|
Stage: 2 of 2 'Enabling keys' 0% of stage done
|
|
|
|
|
|
|
|
|
|
(B[0;1mQuery OK, 0 rows affected (0.01 sec)
|
|
|
|
|
(B[m(B[0;1mRecords: 0 Duplicates: 0 Warnings: 0
|
|
|
|
|
(B[m(B[0;1m
|
|
|
|
|
(B[mMariaDB [ishoebot]> ALTER TABLE Enrollments
|
|
|
|
|
-> ADD FOREIGN KEY(StudentID)
|
|
|
|
|
-> REFERENCES Students(StudentID)
|
|
|
|
|
-> ON DELETE NO ACTION
|
|
|
|
|
-> ON UPDATE CASCADE;
|
|
|
|
|
Stage: 2 of 2 'Enabling keys' 0% of stage done
|
|
|
|
|
|
|
|
|
|
(B[0;1mQuery OK, 0 rows affected (0.01 sec)
|
|
|
|
|
(B[m(B[0;1mRecords: 0 Duplicates: 0 Warnings: 0
|
|
|
|
|
(B[m(B[0;1m
|
|
|
|
|
(B[mMariaDB [ishoebot]> ALTER TABLE Enrollments
|
|
|
|
|
-> ADD FOREIGN KEY(studentID)
|
|
|
|
|
-> REFERENCES Students(studentID)
|
|
|
|
|
-> ON DELETE NO ACTION
|
|
|
|
|
-> ON UPDATE CASCADE;
|
|
|
|
|
Stage: 2 of 2 'Enabling keys' 0% of stage done
|
|
|
|
|
|
|
|
|
|
(B[0;1mQuery OK, 0 rows affected (0.01 sec)
|
|
|
|
|
(B[m(B[0;1mRecords: 0 Duplicates: 0 Warnings: 0
|
|
|
|
|
(B[m(B[0;1m
|
|
|
|
|
(B[mMariaDB [ishoebot]> ALTER TABLE EN nrollments DROP CONSTRAINT ENrollm nrollments_ibfk_4
|
|
|
|
|
-> ;
|
|
|
|
|
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'CONSTRAINT Enrollments_ibfk_4' at line 1
|
|
|
|
|
(B[0;7m(B[mMariaDB [ishoebot]> ;ALTER TABLE Enrollments DROP CONSTRAINT Enrollments_ibfk_4 studentID;
|
|
|
|
|
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'CONSTRAINT studentID' at line 1
|
|
|
|
|
(B[0;7m(B[mMariaDB [ishoebot]> ALTER TABLE Enrollments DROP CONSTRAINT studentID;
|
|
|
|
|
MariaDB [ishoebot]> ;[KALTER TABLE Enrollments DROP CONSTRAINT Enrollments_ibfk_4 4l ;s DROP CONSTRAINT[1P[1P[1P[1P[1P[1P[1P[1P[1P[1P[1@I[1@N[1@D[1@E[1@X Enrollments_ibfk_4;
|
|
|
|
|
ERROR 1091 (42000): Can't DROP 'Enrollments_ibfk_4'; check that column/key exists
|
|
|
|
|
(B[0;7m(B[mMariaDB [ishoebot]> ALTER TABLE Enrollments DROP INDEX Enrollments_ibfk_4; St studentID;
|
|
|
|
|
ERROR 1091 (42000): Can't DROP 'studentID'; check that column/key exists
|
|
|
|
|
(B[0;7m(B[mMariaDB [ishoebot]> ALTER TABLE Enrollments DROP INDEX studentID; constraint slect elect studentID from Enrollments where atler lter table student Enrollments drop coluy olumn studentID cascade constraints
|
|
|
|
|
-> ;
|
|
|
|
|
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'constraints' at line 1
|
|
|
|
|
(B[0;7m(B[mMariaDB [ishoebot]> ;alter table Enrollments drop column studentID cascade constraintsmn stttn[1P[1P[1P[1P[1P[1P[1@i[1@n[1@d[1@e[1@x
|
|
|
|
|
-> ;
|
|
|
|
|
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'cascade constraints' at line 1
|
|
|
|
|
(B[0;7m(B[mMariaDB [ishoebot]> ;alter table Enrollments drop index studentID cascade constraints
|
|
|
|
|
MariaDB [ishoebot]> ;[Kalter table Enrollments drop column studentID cascade constraintss indexl ;
|
|
|
|
|
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'index' at line 1
|
|
|
|
|
(B[0;7m(B[mMariaDB [ishoebot]> alter table Enrollments drop column studentID cascade index;
|
|
|
|
|
MariaDB [ishoebot]> ;[Kalter table Enrollments drop index studentID cascade constraintsex[1P[1P[1P[1P[1P[1@s[1@t[1@u[1@d[1P[1P[1P[1P[1P studentID cascade constraints;
|
|
|
|
|
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'constraints' at line 1
|
|
|
|
|
(B[0;7m(B[mMariaDB [ishoebot]> drop table Enrollments
|
|
|
|
|
-> ;
|
|
|
|
|
(B[0;1mQuery OK, 0 rows affected (0.00 sec)
|
|
|
|
|
(B[m(B[0;1m
|
|
|
|
|
(B[mMariaDB [ishoebot]> CREATE TABLE Enrollments
|
|
|
|
|
-> (
|
|
|
|
|
-> studentID INT,
|
|
|
|
|
-> courseID INT,
|
|
|
|
|
-> letterGrade CHAR(2),
|
|
|
|
|
-> PRIMARY KEY(studentID, courseID),
|
|
|
|
|
-> FOREIGN KEY(studentID)
|
|
|
|
|
-> REFERENCES Students(studentID)
|
|
|
|
|
-> ON DELETE NO ACTION
|
|
|
|
|
-> ON UPDATE CASCADE
|
|
|
|
|
-> );
|
|
|
|
|
(B[0;1mQuery OK, 0 rows affected (0.00 sec)
|
|
|
|
|
(B[m(B[0;1m
|
|
|
|
|
(B[mMariaDB [ishoebot]> ALTER TABLE Enrollments
|
|
|
|
|
-> ADD FOREIGN KEY(courseID)
|
|
|
|
|
-> REFERENCES Courses(courseID)
|
|
|
|
|
-> ON DELETE NO ACTION
|
|
|
|
|
-> ON UPDATE CASCADE;
|
|
|
|
|
Stage: 2 of 2 'Enabling keys' 0% of stage done
|
|
|
|
|
|
|
|
|
|
(B[0;1mQuery OK, 0 rows affected (0.01 sec)
|
|
|
|
|
(B[m(B[0;1mRecords: 0 Duplicates: 0 Warnings: 0
|
|
|
|
|
(B[m(B[0;1m
|
|
|
|
|
(B[mMariaDB [ishoebot]> INSERT INTO Courses(courseNum, courseName, courseDescription, creditHours)
|
|
|
|
|
Data & Inform -> VALUES ('CS1103', 'Data & Information Management', 'Introduction to Databases', 7);
|
|
|
|
|
(B[0;1mQuery OK, 1 row affected (0.00 sec)
|
|
|
|
|
(B[m(B[0;1m
|
|
|
|
|
(B[mMariaDB [ishoebot]> select * from Courses;
|
|
|
|
|
+----------+-----------+-------------------------------+---------------------------+-------------+
|
|
|
|
|
| courseID | courseNum | courseName | courseDescription | creditHours |
|
|
|
|
|
+----------+-----------+-------------------------------+---------------------------+-------------+
|
|
|
|
|
| 1 | CS1103 | Data & Information Management | Introduction to Databases | 7 |
|
|
|
|
|
+----------+-----------+-------------------------------+---------------------------+-------------+
|
|
|
|
|
(B[0;1m1 row in set (0.00 sec)
|
|
|
|
|
(B[m(B[0;1m
|
|
|
|
|
(B[mMariaDB [ishoebot]> INSERT INTO Courses(courseNum, courseName, courseDescription, creditHours)
|
|
|
|
|
-> VALUES ('CS1303', 'Discrete Structures', 'Computer Science but it\'s math actually', 4);
|
|
|
|
|
(B[0;1mQuery OK, 1 row affected (0.00 sec)
|
|
|
|
|
(B[m(B[0;1m
|
|
|
|
|
(B[mMariaDB [ishoebot]> ALTER TABLE Courses ADD approvedDate DATETIME;
|
|
|
|
|
Stage: 2 of 2 'Enabling keys' 0% of stage done
|
|
|
|
|
|
|
|
|
|
(B[0;1mQuery OK, 2 rows affected (0.01 sec)
|
|
|
|
|
(B[m(B[0;1mRecords: 2 Duplicates: 0 Warnings: 0
|
|
|
|
|
(B[m(B[0;1m
|
|
|
|
|
(B[mMariaDB [ishoebot]> UPDATE Courses
|
|
|
|
|
rovedDate = ("2020-7- -> SET approvedDate = ("2020-7-8")
|
|
|
|
|
-> where courseID = 1;
|
|
|
|
|
(B[0;1mQuery OK, 1 row affected (0.00 sec)
|
|
|
|
|
(B[m(B[0;1mRows matched: 1 Changed: 1 Warnings: 0
|
|
|
|
|
(B[m(B[0;1m
|
|
|
|
|
(B[mMariaDB [ishoebot]> select studentName, courseName, letterGrade
|
|
|
|
|
-> from Students
|
|
|
|
|
-> natural join Enrollments
|
|
|
|
|
-> natural join Courses;
|
|
|
|
|
(B[0;1mEmpty set (0.00 sec)
|
|
|
|
|
(B[m(B[0;1m
|
|
|
|
|
(B[mMariaDB [ishoebot]> INSERT INTO Students(studentName, email, gpa, dateOfBirth)
|
|
|
|
|
-> VALUES ('Isaac Shoebottom', 'ir.shoebottom@gmail.com', 3.5, "2002-08-07");
|
|
|
|
|
(B[0;1mQuery OK, 1 row affected (0.00 sec)
|
|
|
|
|
(B[m(B[0;1m
|
|
|
|
|
(B[mMariaDB [ishoebot]> INSERT INTO Enrollments(studentID, courseID, letterGrade)
|
|
|
|
|
-> VALUES(1, 1, '85');
|
|
|
|
|
(B[0;1mQuery OK, 1 row affected (0.01 sec)
|
|
|
|
|
(B[m(B[0;1m
|
|
|
|
|
(B[mMariaDB [ishoebot]> INSERT INTO Enrollments(studentID, courseID, letterGrade)
|
|
|
|
|
-> VALUES(1, 2, '95');
|
|
|
|
|
(B[0;1mQuery OK, 1 row affected (0.01 sec)
|
|
|
|
|
(B[m(B[0;1m
|
|
|
|
|
(B[mMariaDB [ishoebot]> select studentName, courseName, letterGrade
|
|
|
|
|
-> from Students
|
|
|
|
|
-> natural join Enrollments
|