You are on page 1of 9

Assignment – 1

Name: Fazlur Rahman


Student ID: 301342012
Course: Introduction to Database Concepts
Section: 006
Professor: Farhan Mazhar
Date of Submission: 5th June 2023
Q - 01
a) Entities and Attribues:

Patient entity:

Attributes: patient_id, patient_name, birth date, associate_number, email

Doctor entity:

Attributes: doctor_id, doctor_name, specialization, qualifications, associate_number, email

Appointment entity:

Attributes: visit_id, patient_id, doctor_id, visit_date, visit_time, reason, status

b) Relationships:

One-to-One:

Example: Each patient can have only one primary doctor, and each primary doctor can be assigned to
only one patient.

One-to-Many:

Example: Each doctor can have multiple appointments, but each appointment is associated with only
one doctor.

Many-to-Many:

Example: Multiple patients can have multiple appointments, and each appointment can have multiple
patients.

In the alternative answer, the entities and their attributes remain the same as in the previous answer.
However, the relationships are explained with slightly different examples to demonstrate the different
types of relationships.
Q -02

a) A college needs to track placement test scores for incoming students. Each student can take a
variety of tests, including English and math. Some students are required to take placement
tests because of previous coursework.

b) Every employee in a company is assigned to one department. Every department can contain
many employees.
c) Data for an information technology conference needs to be collected. The conference has a
variety of sessions scheduled over a two-day period. All attendees must register for the
sessions they plan to attend. Some speakers are presenting only one session, whereas others
are handling multiple sessions. Each session has only one speaker.

Q - 03

1. Display a list of all data contained in the BOOKS table.


2. List the title only of all books available in inventory, using the BOOKS table.

3. List the title and publication date for each book in the BOOKS table. Use the column
heading “Publication Date” for the Pubdate field.
4. List the customer number for each customer in the CUSTOMERS table, along with the
city and state in which the customer lives.

5. Create a list containing the publisher’s name, the person usually contacted, and the
publisher’s telephone number. Rename the contact column “Contact Person” in the
displayed results.
6. Determine which categories are represented in the current book inventory. List each
category only once.

7. List the customer number from the ORDERS table for each customer who has placed an
order with the bookstore. List each customer number only once.
8. Create a list of each book title stored in the BOOKS table and the category in which each
book belongs. Reverse the sequence of the columns so that the category of each book is
listed first.

9. Create a list of authors that displays the last name followed by the first name for each
author. The last names and first names should be separated by a comma and a blank
space.
10. List all information for each order item. Include an item total, which can be calculated by
multiplying the Quantity and Paideach columns. Use a column alias for the calculated
value to show the heading “Item Total” in the output.

You might also like