0% found this document useful (0 votes)
3 views

SQL

Uploaded by

areteshephaestus
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

SQL

Uploaded by

areteshephaestus
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

CREATE DATABASE db_students_list;

USE db_students_list;

CREATE TABLE Subject (


ID INT AUTO_INCREMENT PRIMARY KEY,
Subjname VARCHAR(255) NOT NULL,
Subjcode VARCHAR(255) NOT NULL,
Grade VARCHAR(255) NOT NULL,
Student_ID INT NOT NULL,
FOREIGN KEY (Student_ID) REFERENCES Students(ID)
);

CREATE TABLE students (


ID INT AUTO_INCREMENT PRIMARY KEY,
Lastname VARCHAR(255) NOT NULL,
Firstname VARCHAR(255) NOT NULL,
Age INT NOT NULL,
Course VARCHAR(255) NOT NULL
);

INSERT INTO students


VALUES ('1','Setera', 'John Kevin', 20, 'BSINFOTECH'),
('2','Senobio', 'Julius Robert', 34, 'BSINFOTECH'),
('3','Amante', 'Limuel Jay', 19, 'BSINFOTECH'),
('4','Podiotan', 'Neous', 20, 'BSINFOTECH'),
('5','De Castro', 'Mark Paulo', 20, 'BSINFOTECH'),
('6','Suayan', 'Edmar', 19, 'BSINFOTECH'),
('7','Macaraig', 'Ceejay', 20, 'BSINFOTECH'),
('8','Naje', 'Marvin', 20, 'BSINFOTECH'),
('9','Virina', 'Juan Miguel', 20, 'BSINFOTECH'),
('10','Fule', 'Tatz', 20, 'BSINFOTECH');

INSERT INTO subjects


VALUES ("1", 'Information Management', 'ITEC 205', '1.25', 1),
("2", 'Object Oriented Programming', 'ITEC 201', '1.75', 2),
("3", 'Platform Technology', 'ITEL 202', '1.50', 3);

UPDATE Students
SET course = 'BSCOMSCI'
WHERE id = 1;

You might also like