Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Cardinality in ER Diagram, Lecture notes of Database Management Systems (DBMS)

About degree of relationship between two entity

Typology: Lecture notes

2020/2021

Uploaded on 03/26/2021

nidhi-singh-18
nidhi-singh-18 🇮🇳

1 document

1 / 13

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
CARDINALITY
Presented By
Nidhi Singh
pf3
pf4
pf5
pf8
pf9
pfa
pfd

Partial preview of the text

Download Cardinality in ER Diagram and more Lecture notes Database Management Systems (DBMS) in PDF only on Docsity!

CARDINALITY

Presented By

Nidhi Singh

COURSE OUTCOME

  • (^) TO UNDERSTAND DEGREE OF RELATIONSHIP
  • (^) TO UNDERSTAND TYPE OF RELATIONSHIP
  • (^) HOW TO REDUCE THE TABLE

ONE TO ONE

EMPLOYEE WORK DEPARTMENT

D_ID D_NAME LOCATION

D1 HR^ PUNE

D2 IT^ DELHI

D3 FINANACE^ NOIDA

D4 MARKETING^ JAIPUR

E_ID E_NAME AGE

1 ANIL 24

2 SUNIL 27

3 RITIKA 25

4 SIMITA 28

E_ID D_ID

1 D

2 D

3 D

4 D

RELATIONSHIP TABLE

  • (^) WHAT ATTRIBUTES WILL RELATIONSHIP TABLE CONTAIN?
  • (^) HOW HAVE YOU PUT THE VALUE INSIDE RELATIONSHIP TABLE?
  • (^) WHAT IS PRIMARY KEY?
  • (^) CAN I REDUCE THE TABLE?

E_ID E_NAME AGE D_ID

1 ANIL 24 D

2 SUNIL 27 D

3 RITIKA 25 D

4 SIMITA 28 D

ONE TO MANY

  • (^) WHAT ATTRIBUTES WILL RELATIONSHIP TABLE CONTAIN?
  • (^) HOW HAVE YOU PUT THE VALUE INSIDE RELATIONSHIP TABLE?
  • (^) WHAT IS PRIMARY KEY?
  • (^) CAN I REDUCE THE TABLE?
  • (^) Note: Attribute of relationship table called descriptive attribute ID_NAME O_NUM DATE ITEM_NAME COST 1 D1 11/2/21 PASTA 128 1 D2 30/3/20 BURGER 234 2 D3 15/2/21 PIZZA 250 2 D4 22/3/20 SPRING ROLL 110

MANY TO MANY

STUDENT STUDY COURSE

C_ID NAME CREDIT
D1 HR 4
D2 MARKETING 4
D3 FINANCE 4
D4 IT 4
STUD_ID NAME AGE
1 ANIL 18
2 SUNIL 19
3 RITIKA 20
4 SIMITA 21
STUD_ID C_ID
1 D
1 D
2 D
2 D

HOW MANY TABLES WILL FORM?

E1 E

R

R

A B

  • (^) CREATE THE TABLE EMPLOYEE
  • (^) INSERT ATTRIBUTE
    • EMP_ID
    • (^) FIRST_NAME
    • (^) LAST_NAME
    • (^) E_MAIL
    • (^) PHONE_NUM
    • HIRE_DATE
    • (^) JOB_ID
    • (^) SALARY
    • (^) DEPARTMENT_ID
    • MANAGER_ID
1. Write a query in SQL to display the full name (first and last name), and salary for those employees who earn below 6000.
2. Write a query in SQL to display the first and last name, and department number for all employees whose last name is
“SINGH”
3. Write a query in SQL to display display all the information for all movies who have the letters M in movie title

UNIQUE

  • (^) The Unique constraint ensures that all values in a column are

different

  • (^) CREATE TABLE Persons (

ID int NOT NULL UNIQUE,

Last_Name varchar(255) NOT NULL,

First_Name varchar(255),

Age int

  • (^) ALTER TABLE Persons

ADD UNIQUE (ID);