0% found this document useful (0 votes)
110 views6 pages

ASSIGNMENT NO 03 DB

The document describes an EER schema for a financial institution database. The schema models customers, employees, deposits, debentures, shares and dividends. It contains tables for customers, deposits, employees, financial instruments and their relationships.

Uploaded by

Mohsin Abbasi
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)
110 views6 pages

ASSIGNMENT NO 03 DB

The document describes an EER schema for a financial institution database. The schema models customers, employees, deposits, debentures, shares and dividends. It contains tables for customers, deposits, employees, financial instruments and their relationships.

Uploaded by

Mohsin Abbasi
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/ 6

Data Base Systems (CSC402)

ASSIGNMENT NO 03

Submitted to:
DR. MADIHA

Submitted by:
MOHSIN IDREES
SP21-BAI-014
Question - 1:
Design an EER-schema for a database of a canteen/cafeteria. The canteen has a certain feature of menus it can
produce. Each menu has an identifying number, a name, and a price. The name is used for advertising the menu;
menus which differ only slightly can have the same name. Each day, the canteen offers several menus. It wants
to store which menu was offered on which day and how often it was sold. Internally, the menus are constructed
from a main course (usually meat) and several side dishes (such as soup, salad, vegetables, dessert). In this
canteen the customer cannot choose the side dishes. The composition of menu is used only for the preparation,
because every component (main dish or side dish) can be prepared independently. Also, if some component is
used in different menus, the information about it does not have to be stored redundantly. For every menu
component, the recipe has to be stored (how to cook this part of the meal).

EERD:

Relational Schema:
Menu (menu_id (PK), name, price)
MenuComponent (component_id (PK), menu_id (FK), component_type (main course or side
dish), recipe)
Ingredient (ingredient_id, name, calories)
MenuComponentIngredient (component_id (FK), ingredient_id (FK), quantity)
MenuSale (menu_id (FK), sale_date, quantity_sold)

The schema includes the following tables:


1. Menu Table: Stores information about each menu offered by the canteen. The
menu_id is the primary key, uniquely identifying each menu. The name represents the
menu's name for advertising purposes, and the price stores the price of the menu.

2. MenuComponent Table: Represents the components of each menu. The


component_id is a unique identifier for each component, and the menu_id is a foreign
key referencing the Menu Table to associate each component with its menu. The
component_type indicates whether the component is a main course or a side dish. The
recipe column holds the instructions for cooking the component.

3. Ingredient Table: Contains information about each ingredient used in the menu
components. The ingredient_id serves as the primary key, and the name stores the
name of the ingredient. The calories column records the number of calories per 100
grams of the ingredient.

4. MenuComponentIngredient Table: Represents the relationship between menu


components and the ingredients used in them. It has a composite primary key
consisting of component_id (foreign key referencing MenuComponent Table) and
ingredient_id (foreign key referencing Ingredient Table). The quantity column
specifies the amount of each ingredient used in grams for a particular menu
component.

5. MenuSale Table: Stores data about the sales of menus. The menu_id column is a
foreign key referencing the Menu Table, indicating which menu was sold. The
sale_date column records the date of the sale, and the quantity_sold column represents
the number of times the menu was sold on a specific day.
Problem-4: Finance Company

A financial institution offers different investment schemes to its customers such as shares and
debentures. The company also accepts fixed deposits from the general public, institutions, and its
employees. The company keeps a database with valuable information about its customers (such as ID,
name, and address), which could be individual customers, employees and financial institutions.
Institutions have focal person and other details along with ID, name, address etc.
Fixed deposits have varying terms of 1, 2, or 3 years. For fixed deposits there are currently two
payment schemes. Under the first scheme, the investors get the principal plus the interest on maturity.
Under the second scheme, they get the principal on maturity, but interest is paid periodically. The
interest rates for fixed deposits under the first scheme may be paid quarterly, semi-annually, or
annually. Investors have the option to renew their deposits on maturity.
The company also raises debentures periodically. The debentures may be either convertible or
nonconvertible. Convertible debentures can be converted to equity shares on completion of the period.
Debentures are issued for periods of 1, 2 or 3 years.
The company also calls for shares periodically. The company issues two kinds of shares: equity shares
and preferred shares. The dividend is declared at the end of the year. The system keeps track of the
dividend rates, dividend issued to the shareholders, etc.
The company has employees which deal with depositors. Employees can be permanent with job
experience in years and can be contractual with contract duration and specific dates (starting and
ending).
Draw the EER diagram of this database. Identify (if any) the subtypes of entity financial instrument and
member. Identify one (or more) unique attribute (relationship) for each subtype as well as one (or
more) attribute that is shared by all entity subtypes.

EERD:

Relational Schema:
 Customer (customer_id (PK), customer_type, name, address)
 IndividualCustomer (customer_id (PK)(FK))
 Employee (employee_id (PK), employee_type, name, address, experience_years
(applicable for permanent employees))
 PermanentEmployee (employee_id (PK)(FK)))
 ContractEmployee(employee_id (PK)(FK), contract duration, start_date, end_date)
 FinancialInstitution (institution_id (PK), institution_type, name, address,
focal_person)
 Deposit (deposit_id (PK), customer_id (FK), deposit_type, term (1, 2, or 3 years),
renewal_option)
 FixedDeposit(deposit_id (PK),(FK), payment_scheme (first or second),
interest_payment_frequency (quarterly, semi-annually, annually) )
 Debenture (debenture_id (PK), debenture_type (convertible or non-convertible), term
(1, 2, or 3 years))
 Share (share_id (PK), share_type (equity or preferred), dividend_rate)
 Shareholder (shareholder_id (PK), customer_id(FK), share_id(FK))
 Dividend (dividend_id (PK), shareholder_id(FK), dividend_amount, year)

This schema includes the following tables:


1. Customer Table: Stores information about customers, including their unique
customer_id, customer_type (individual, employee, or financial institution), name,
and address.

2. IndividualCustomer Table: Contains additional details specific to individual


customers, with customer_id as a foreign key referencing the Customer Table.

3. Employee Table: Holds information about employees, including their unique


employee_id, employee_type, name, address, and experience_years (applicable for
permanent employees).

4. PermanentEmployee Table: Contains details specific to permanent employees, with


employee_id as a foreign key referencing the Employee Table.

5. ContractEmployee Table: Stores details specific to contractual employees, including


contract_duration, start_date, and end_date, with employee_id as a foreign key
referencing the Employee Table.

6. FinancialInstitution Table: Stores information about financial institutions, including


their unique institution_id, institution_type, name, address, and focal_person.
7. Deposit Table: Represents the deposits made by customers, with deposit_id as the
primary key. It includes customer_id as a foreign key referencing the Customer Table,
deposit_type (such as fixed deposit), term (1, 2, or 3 years), and renewal_option
(indicating if the deposit can be renewed).

8. FixedDeposit Table: Contains details specific to fixed deposits, including


payment_scheme (first or second) and interest_payment_frequency (quarterly, semi-
annually, or annually), with deposit_id as a foreign key referencing the Deposit Table.

9. Debenture Table: Represents the debentures issued by the company, with


debenture_id as the primary key. It includes debenture_type (convertible or non-
convertible) and term (1, 2, or 3 years).

You might also like