You are on page 1of 1

Instructions:

1. Work in groups of 3 students


2. For each question, provide a screenshot of commands that have been used
3. The assignment will be submitted not later than Tuesday,06/02/2024

Questions

1. Create database hospital


2. Create the following tables:
• patient(patientId varchar(10) primary key ,firstName varchar(20), lastName
varchar(20),dob date,email varchar(20) unique)
• doctor(doctorId varchar(10) primary key,firstName varchar(20), lastName
varchar(20),dob date,email varchar(20) degree varchar (20), phone varchar(20))
• apartment(roomNo int primary key,roomDescription varchar(10))
3. add doctorId varchar(10) column on patient table
4. add foreign key constraint on patient table, name it “FK_doctor”
5. change the email column in doctor, make it unique and not null
6. rename the table apartment to room
7. delete the foreign key constraint
8. create user Benite with password “sky”
9. insert into patient table the following data:

PatientId FirstName lastName dob email


Pt002 Anne Ineza 12/05/2010 ineza@gmail.com
Pt004 Alex Kalisa 07/08/2003 kalisa@gmail.com
10. Retrieve the date of birth (dob) of Alex
11. Create user Sam with password “lucas”
12. Grant all privileges to user Sam
13. Grant “select privilege “ on patient table to user Benite
14. Login as Benite , then select the data of patient with id=pt002
15. Login as Sam and change the firstName of kalisa . The new firstName is “Elvin”

You might also like