Database Lab

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 2

ICS 2206 INTRO TO DBMS

LAB EXERCISE TWO


Instructions: Use mySQL interface to do the following exercises
Using mySQL create the following tables
NOTE: CREATE THE TABLES DEFINING THE FIELDS, THEN INSERT THE RECORDS USING
THE INSERT STATEMENT

Student
ID FirstLast
S103 John Smith
S104 Mary Jones
S105 Jane Brown
S106 Mark Jones
S107 John Brown

Grade
ID Code Mark
S103 DBS 72
S103 IAI 58
S104 PR168
S104 IAI 65
S106 PR243
S107 PR176
S107 PR260
S107 IAI 35
Course
Code Title
DBS Database Systems
PR1Programming 1
PR2Programming 2
IAI Intro to AI
ALTERING TABLES
ALTER TABLE Student
ADD COLUMN
Degree VARCHAR(50)

ALTER TABLE Student


DROP COLUMN Degree

ALTER TABLE Course


ADD CONSTRAINT
ck UNIQUE (title)

ALTER TABLE Course


DROP CONSTRAINT ck

UPDATE Student
SET Year = 1,
Name = ‘EMMA’
WHERE ID = S104

UPDATE Student
SET Year = Year + 1

You might also like