You are on page 1of 16

Mbarara university of science and technology

Faculty of computing and informatics


Department of information Technology
Answers to test questions
Course Unit: database programming
Course code: bit 2203
Lecturer-in-charge: mr. Rogers Mwavu
Submitted by: Jedidiah Shalom
Reg. No.: 2019/Bit/011/Ps
Date: 08/04/2024
e. Flowchart Diagram.
f. Entity Relationship Diagram (ERD)

Question Two:

a. Creating the table Patient and adding a column called PhoneNumber: the code I used to change the table
name is this: RENAME Patient TO HospitalPatient;
Dropping column DOB, creating an index on LastName:

b. Inserting, updating, and deleting patient records.


Retrieving records and counting the number of patients:
c. Creating a table and inserting records:

Retrieving records updating a column:


Joining two tables:

Question Three:
a. Creating schema and creating tables with foreign keys:
b. Adding, enrolling, listing students, listing courses, updating a course description, and
deleting an enrolment:
c. Trigger to enforce policy:

Question Four:
i. Creating tables:
Inserting into sales and customers, adding columns to the tables, and designing a
unique index:
Creating a view and updating it:

Question Five:
Structure for table named 2018markschanged where data is inserted post-trigger execution:
a. Trigger for the Cyber College of Technology (CCT) named 2018markschange, invoked
BEFORE an UPDATE operation:
b. SQL query to update the studentsmarks2018 table:

Question Six:
Syntax and execution of a stored procedure:
a. Stored procedure to create accounts for staff members:

You might also like