Created
June 11, 2021 08:17
-
-
Save AbudiMutamba/8c8bf419659da3450129aff830ab9f26 to your computer and use it in GitHub Desktop.
our second online sessionl of solver course
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*CREATe TABLE students ( | |
id int(20) NOT NULL, | |
name VARCHAR(200), | |
PRIMARY KEY (id) | |
*/ | |
/*CREATE TABLE results ( | |
id int(20) AUTO_INCREMENT, | |
subject VARCHAR(100) NOT NULL, | |
marks INT(3), | |
PRIMARY KEY(id) | |
);*/ | |
-- DROP TABLE payment; | |
-- Add a new column to the results table | |
-- The column name is student_id and it accepts integer values | |
-- ALTER TABLE results | |
-- COLUMN student_id INT NOT NULL; | |
-- Make the student_id a foreign key | |
-- ALTER TABLE results | |
-- ADD FOREIGN KEY (student_id) REFERENCES students(id); | |
-- Alter TABLE demo | |
-- ADD COLUMN student_id INT NOT NULL; | |
-- ALTER TABLE demo | |
-- ADD FOREIGN KEY (student_id) REFERENCES students(id); | |
-- DROP TABLE results; | |
/* CREATE TABLE results ( | |
id int NOT NULL AUTO_INCREMENT, | |
subject VARCHAR(100) NOT NULL, | |
marks INT(3), | |
student_id INT(20), | |
PRIMARY KEY(id), | |
FOREIGN KEY (student_id) REFERENCES students(id) | |
); | |
*/ | |
-- ALTER TABLE results | |
-- DROP FOREIGN KEY student_id; | |
-- ALTER TABLE results | |
-- DROP INDEX student_id | |
/*ALTER TABLE results | |
ADD CONSTRAINT FK_student_id | |
FOREIGN KEY (student_id) REFERENCES students(id); | |
*/ | |
/* ALTER TABLE results | |
DROP FOREIGN KEY FK_student_id; | |
*/ | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment