✏️ Explanatory Question

রিলেশনাল স্কিমা কী? (Relational Schema)

👁 3 Views
📘 Detailed Answer
🟢 Easy
💡

Answer with Explanation

  উত্তর: DBMS বা Database Management System-এর ক্ষেত্রে রিলেশনাল স্কিমা বলতে একটি relational database-এর table বা relation-এর গঠন বা structure-কে বোঝায়। এটি নির্দেশ করে যে কোনো table-এ কী কী attribute বা column থাকবে, প্রতিটি attribute-এর data type কী হবে, কোন attribute primary key হবে এবং table-গুলোর মধ্যে কী ধরনের relationship থাকবে।

রিলেশনাল স্কিমা মূলত database table-এর একটি পরিকল্পিত কাঠামো বা blueprint। এটি actual data নয়; বরং data কীভাবে table-এর মধ্যে সাজানো হবে, সেটির নিয়ম ও গঠন প্রকাশ করে।

  সহজ ভাষায়: রিলেশনাল স্কিমা হলো table-এর নকশা, যেখানে table-এর নাম, column-এর নাম, key এবং relationship দেখানো হয়।


  পরীক্ষার জন্য সংক্ষিপ্ত উত্তর

রিলেশনাল স্কিমা হলো relational database-এর একটি logical structure, যার মাধ্যমে table-এর নাম, attributes বা columns, data types, primary key, foreign key এবং constraints নির্ধারণ করা হয়। এটি database table-এর design বা blueprint হিসেবে কাজ করে।


  সহজভাবে ব্যাখ্যা

ধরা যাক, একটি স্কুলের database তৈরি করতে হবে। সেখানে ছাত্রদের তথ্য রাখার জন্য Student নামে একটি table তৈরি করা হবে। এখন Student table-এ কী কী তথ্য রাখা হবে, যেমন Roll, Name, Class, Marks — এগুলো আগে থেকে ঠিক করতে হবে।

এই table-এর নাম, column-এর নাম এবং key কী হবে—এসব একসাথে লিখে যে structure তৈরি করা হয়, সেটিই হলো Relational Schema

  সহজ উদাহরণ: একটি স্কুলে ছাত্রদের তথ্য রাখার জন্য আমরা যদি Student table-এর structure লিখি—

Student (Roll, Name, Class, Marks)

এখানে Student হলো table বা relation-এর নাম এবং Roll, Name, Class, Marks হলো attributes বা columns। এটিই একটি relational schema-এর উদাহরণ।


  রিলেশনাল স্কিমার প্রধান উপাদান

  •   Relation Name: table বা relation-এর নামকে relation name বলা হয়।
    উদাহরণ: Student, Teacher, Course।
  •   Attributes: table-এর column-গুলোকে attribute বলা হয়।
    উদাহরণ: Roll, Name, Class, Marks।
  •   Domain: কোনো attribute কী ধরনের value গ্রহণ করবে, তাকে domain বলা হয়।
    উদাহরণ: Roll হবে integer, Name হবে text, Marks হবে number।
  •   Primary Key: যে attribute প্রতিটি record-কে uniquely identify করে, তাকে primary key বলা হয়।
    উদাহরণ: Student table-এ Roll number primary key হতে পারে।
  •   Foreign Key: একটি table-এর attribute যদি অন্য table-এর primary key-এর সাথে সম্পর্ক তৈরি করে, তাহলে তাকে foreign key বলা হয়।
    উদাহরণ: Student table-এর Course_ID attribute Course table-এর Course_ID-এর সাথে যুক্ত হতে পারে।
  •   Constraints: data সঠিক ও নিয়ন্ত্রিত রাখার জন্য যে নিয়ম ব্যবহার করা হয়, তাকে constraints বলা হয়।
    উদাহরণ: NOT NULL, UNIQUE, PRIMARY KEY।

  রিলেশনাল স্কিমার সাধারণ রূপ

রিলেশনাল স্কিমা সাধারণত নিচের format-এ লেখা হয়:

Relation_Name (Attribute1, Attribute2, Attribute3, ...)

যেমন:

Student (Roll, Name, Class, Marks)

এখানে:

  •   Student হলো relation বা table-এর নাম।
  •   Roll, Name, Class, Marks হলো attributes বা columns।
  •   Roll primary key হিসেবে ব্যবহার করা যেতে পারে।

  বাস্তব উদাহরণ: School Database

ধরা যাক, একটি school database-এ তিনটি table আছে:

Student (Roll, Name, Class, Address)
Teacher (Teacher_ID, Teacher_Name, Subject)
Result (Roll, Subject, Marks)

এখানে প্রতিটি line একটি relational schema প্রকাশ করছে।

  •   Student table ছাত্রদের তথ্য রাখে।
  •   Teacher table শিক্ষকদের তথ্য রাখে।
  •   Result table ছাত্রদের marks রাখে।

  Student table-এর Roll attribute Result table-এর Roll attribute-এর সাথে সম্পর্ক তৈরি করতে পারে। এভাবে relational schema table-গুলোর মধ্যে relationship বোঝাতেও সাহায্য করে।


  Table-এর মাধ্যমে বোঝা যাক

Roll Name Class Marks
1 Rahul 10 85
2 Sima 10 90

উপরের table-টির relational schema হলো:

Student (Roll, Name, Class, Marks)

এখানে actual table-এ data আছে, কিন্তু schema শুধু table-এর structure বা design দেখায়।


  Relation Schema এবং Relation Instance-এর পার্থক্য

বিষয় Relation Schema Relation Instance
অর্থ Table-এর structure বা design Table-এর বর্তমান data
পরিবর্তন সাধারণত কম পরিবর্তন হয় Data insert, update, delete হলে পরিবর্তন হয়
উদাহরণ Student (Roll, Name, Class) Student table-এর actual rows
ধরন Logical structure Current data state

  রিলেশনাল স্কিমার গুরুত্ব

  •   এটি database-এর structure পরিষ্কারভাবে প্রকাশ করে।
  •   কোন table-এ কোন column থাকবে তা নির্ধারণ করে।
  •   Primary key এবং foreign key নির্ধারণে সাহায্য করে।
  •   Table-গুলোর মধ্যে relationship বোঝায়।
  •   Data integrity বজায় রাখতে সাহায্য করে।
  •   Database design সহজ ও সুশৃঙ্খল করে।

  শ্রেণিকক্ষে বোঝানোর সহজ পদ্ধতি

শিক্ষক ছাত্রদের এভাবে বোঝাতে পারেন:

ধরা যাক, তোমরা একটি খাতা তৈরি করছ যেখানে ছাত্রদের তথ্য রাখা হবে। আগে ঠিক করতে হবে খাতায় কোন কোন heading থাকবে—Roll, Name, Class, Marks। এই headings বা columns আগে থেকে ঠিক করে নেওয়াই database-এর ক্ষেত্রে relational schema-এর মতো।

খাতার ভিতরে পরে ছাত্রদের actual information লেখা হবে। কিন্তু headings-গুলো হলো structure। তাই relational schema হলো table-এর headings এবং rules-এর নকশা।


  পরীক্ষায় লেখার নিয়ম

  প্রথমে relational schema-এর সংজ্ঞা লিখবে।
  তারপর লিখবে যে এটি table-এর logical structure দেখায়।
  relation name এবং attributes-এর কথা উল্লেখ করবে।
  primary key, foreign key এবং constraints-এর কথা লিখলে উত্তরটি ভালো হবে।
  শেষে Student (Roll, Name, Class, Marks) এই ধরনের একটি উদাহরণ দেবে।


  মনে রাখার সহজ সূত্র

  রিলেশনাল স্কিমা হলো table-এর নকশা, যেখানে table-এর নাম, columns, keys এবং relationship দেখানো হয়।


  চূড়ান্ত পরীক্ষামূলক উত্তর

DBMS-এর relational model-এ relational schema হলো একটি table বা relation-এর logical structure বা নকশা। এটি relation-এর নাম, attributes বা columns, data type বা domain, primary key, foreign key এবং constraints নির্দেশ করে। Relational schema actual data নয়; এটি কেবল data কীভাবে table-এ সাজানো হবে তা প্রকাশ করে। উদাহরণস্বরূপ, Student (Roll, Name, Class, Marks) একটি relational schema, যেখানে Student হলো relation name এবং Roll, Name, Class, Marks হলো attributes। এখানে Roll primary key হিসেবে ব্যবহার করা যেতে পারে। তাই relational schema database design ও data organization-এর জন্য অত্যন্ত গুরুত্বপূর্ণ।