Relationship in DBMS

 

Relationship এর ধারণা-

 

 


 

 

 দুই বা ততোধিক relation/টেবিল/entity এর মধ্যে সম্পর্ককে relationship বলে

 

1.     Unary Relationship (Within the an entity)

2.     Binary relationship (in between two entities, Student-Teacher)

3.      Ternary Relationship (in between three entities, Student-Teacher-Book)

4.     n-ary relationship (in Between four or more entities, Student-Teacher-Book-Lab-Game)

 

Type of Binary relationship-

1.      One to One(1:1)

একটি entity set এর সঙ্গে অন্য আর একটি entity set এর relationship কে One-to-one (1:1) relationship বলা হয়

যেমন-

1 chair : 1 person

1 headmaster : 1 School

 

2.      One to Many or Many to One (1:m or m:1)

একটি entity set এর সঙ্গে অন্য একাধিক  entity set এর relationship কে One-to-Many (1:n)  relationship বলা হয় এবং এর বিপরীত দিকের relationship কে Many-to-One relationship বলা হয়

 

Example-

1 school: Many students

1 room: Many persons

Many students: 1 teacher

Many Persons: 1 Room

3.      Many to Many(m:n)

একাধিক  entity set এর সঙ্গে অন্য একাধিক  entity set এর relationship কে Many-to-Many (m:n)  relationship বলা হয়

যেমন-

Many students: many teachers

Many customers: many shops

 

Database Constraints

Database এ বৈধ data input করানোর নিয়মাবলীকে database constraints বলে

সুবিধা-

1.      Valid data input করা যায়

2.     Invalid/wrong data প্রবেশ আটকানো যায়

Type-

1.       Key Constraints

এক্ষেত্রে রেকর্ড গুলি স্বতন্ত্র হবে প্রতি relation কমপক্ষে একটি super key থাকবে

 

Roll

Name

Marks

1

Dipen das

32

2

Nripen Dutta

31

3

Somnath Das

33

 

2.      Entity Integrity Constraints

প্রতি relation কমপক্ষে একটি primary key থাকবে primary key যুক্ত attribute কখনোই Null হবে না  

StudentID

Roll

Name

Marks

S001

1

Dipen das

32

S002

2

Nripen Dutta

31

S003

1

Somnath Das

33

 

3.       Domain Integrity Constraints

Domain Integrity Constraintsএর মাধ্যমে database এর মধ্যস্থ কোনো একটি attribute এর মান সঠিক যথাযথ হতে হবে (Right and Proper)

Domain constraints এর মাধ্যমে নিচের বিষয় গুলি দেখে data input করা হয়-

1.      Data type

2.      Length of Attribute

3.      Size of String Data(Char-Fixed, Varchar-Variable character)

4.      Allowed or Not allowed the Null values.

 

4.     Referential Integrity Constraints

দুটি relation এর মধ্যে প্রথম relation এর primary key এর উপর দ্বিতীয় relation এর common attribute নির্ভরশীল হলে, প্রথম relation এর সাপেক্ষে দ্বিতীয় relation এর common attribute কে Foreign key বলা হয় দুটি relation এর record গুলির মধ্যে মিল বা সঙ্গতি বজায় রাখার জন্য referential integrity constraints ব্যবহার করা হয়

Table: Student

StudentID

Student_name

S001

Rakesh Sharma

S002

Kalpana Chawla

 

Table: Student_Result

StudentID

Exam

Marks

S001

E1

30

S002

E1

31

S001

E2

32

S002

E2

31

 

 

Comments

Popular posts from this blog

Computer Memory, Bus and Printer

Computer Science Syllabus(WBCHSE)