0% found this document useful (0 votes)
8 views

DBMS Cat 3

The document describes an entity relationship (ER) diagram for a case study involving salespeople, customers, orders, inventory items, employees, and suppliers. Primary keys and foreign keys are identified for tables created for each entity. A many-to-many relationship between inventory items and parts is represented using a linked entity.

Uploaded by

SHUBHAM
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views

DBMS Cat 3

The document describes an entity relationship (ER) diagram for a case study involving salespeople, customers, orders, inventory items, employees, and suppliers. Primary keys and foreign keys are identified for tables created for each entity. A many-to-many relationship between inventory items and parts is represented using a linked entity.

Uploaded by

SHUBHAM
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Galgotias university

Cat 3(exam)

Course name:-Database Management System


Course code:-B070303T
BCA Sec.4

Name of the students:-

1.shubham kumar singh 21scse1040169

2.siddharth prasad 21scse1040182

3.shuaib malik 21scse1040218

Group no:- 20

Question no:-10
10.A salesperson may manage many other salespeople. A
salesperson is managed by only one salespeople. A salesperson
can be an agent for many customers. A customer is managed by
one salespeople. A customer can place many orders. An order
can be placed by one customer. An order lists many inventory
items. An inventory item may be listed on many orders. An
inventory item is assembled from many parts. A part may be
assembled into many inventory items. Many employees assemble
an inventory item from many parts. A supplier supplies many
parts. A part may be supplied by many suppliers.

For the above case study,you are expected to create the


following .
1. Create the table by identifying the primary key ,unique,foreign
key.

2.Create ER Diagram for the given scenario.

First of all we create a er diagram to create the table


and find the keys.

Er diagram:- ER model stands for an Entity-Relationship model. It is a


high-level data model. This model is used to define the data elements and
relationship for a specified system.

 It develops a conceptual design for the database. It also develops


a very simple and easy to design view of data.
 ER Diagrams contain different symbols that use rectangles to
represent entities, ovals to define attributes and diamond shapes
to represent relationships.
Er diagram of this question
In this er diagram we have four entity ,and we know that entity
should be represent to the rectangles.
Then we create 6 tables for salesperson,customer
,order,product,employee,supplier.
For salesperson:-

For customer:-

For order:-

For product:-

For employee:-
For supplier:-

In these tables we use some datatypes:-


1.VARCHAR:- A VARIABLE length string (can contain letters, numbers, and
special characters).

2. INT:- A medium integer .like number 1,2,34,56

3. CHAR:-A fixed length string

4.TEXT:_- Variable width character string. Holds a string

5. FLOAT:- A floating point number. The total number of digits is specified


in size.

In this diagram :-
PRIMARY KEY:- The PRIMARY KEY constraint uniquely identifies each record in a table. A
table can have only one primary key, which may consist of one single or of multiple fields.
ACCORDING TO THIS POINT THE PRIMARY KEYS OF THESE TABLE.
1.In salesperson table the primary key is Sperson id.
2.In customer table the primary key is customer id.
3.in order table the primary key is order id.
4.in product table the primary key is product id.
5.in employee table the primary key is id.
6.in supplier table the primary key is company name.
Foreign key:- The foreign key constraint is a key used to link two tables
together.
CREATE TABLE Orders (
OrderID int NOT NULL,
OrderNumber int NOT NULL,
PersonID int,
PRIMARY KEY (OrderID),
FOREIGN KEY (SPersonID) REFERENCES SPersons(SPersonID)
);
1.IF we want to link with two table (i.e link with product table and employee
table here employee id is a foreign key.

This is many to many relationship


A many -to-many relationship is split in to pair of one- to many
relationships,connecting with the linked entity.

You might also like