DBMS, RDBMS

 

ডাটাবেস কী?

ডাটাবেস (Database) হলো সংগঠিত ও সুশৃঙ্খলভাবে সংরক্ষিত তথ্যের সমষ্টি, যা সহজে সংরক্ষণ, অনুসন্ধান, পরিবর্তন ও ব্যবস্থাপনা করা যায়।

সহজভাবে বললে—
👉 অনেক তথ্যকে নিয়ম মেনে সাজিয়ে রাখার জায়গাই হলো ডাটাবেস।


🔹 বাস্তব উদাহরণ

১) স্কুল ডাটাবেস

একটি স্কুলে ছাত্রদের তথ্য যেমন—

  • নাম

  • রোল নম্বর

  • শ্রেণি

  • ঠিকানা

এই সব তথ্য যদি টেবিল আকারে সংরক্ষণ করা হয়, সেটিই একটি ডাটাবেস।


২) ব্যাংক ডাটাবেস

ব্যাংকে গ্রাহকের—

  • অ্যাকাউন্ট নম্বর

  • ব্যালেন্স

  • লেনদেনের তথ্য

সব কিছু ডাটাবেসে সংরক্ষণ করা হয়।


🔹 ডাটাবেসের বৈশিষ্ট্য

✔ তথ্য সংগঠিতভাবে সংরক্ষণ করে
✔ দ্রুত অনুসন্ধান করা যায়
✔ একাধিক ব্যবহারকারী একসাথে ব্যবহার করতে পারে
✔ তথ্য নিরাপদ রাখা যায়

🔹 ডাটাবেসের উদাহরণ সফটওয়্যার

  • MySQL

  • Oracle Database

  • Microsoft Access

DBMS কি? (উদাহরণসহ)

DBMS (Database Management System) হলো এমন একটি সফটওয়্যার যা ডাটাবেস তৈরি, সংরক্ষণ, নিয়ন্ত্রণ ও পরিচালনা করে।

সহজ ভাষায়—
👉 ডাটাবেসকে পরিচালনা করার জন্য যে প্রোগ্রাম ব্যবহার করা হয় তাকে DBMS বলে। 


🔹 DBMS-এর কাজ

  1. ডেটা সংরক্ষণ (Store)

  2. ডেটা খোঁজা (Retrieve)

  3. ডেটা পরিবর্তন (Update)

  4. ডেটা মুছে ফেলা (Delete)

  5. নিরাপত্তা প্রদান (Security)

  6. ব্যাকআপ রাখা (Backup)


🔹 উদাহরণ

একটি স্কুলে ছাত্রদের নাম, রোল, শ্রেণি ইত্যাদি তথ্য সংরক্ষণ করার জন্য DBMS ব্যবহার করা হয়।

ব্যাংকের গ্রাহকের অ্যাকাউন্ট নম্বর, ব্যালেন্স ও লেনদেনের তথ্য DBMS দিয়ে পরিচালনা করা হয়।


🔹 জনপ্রিয় DBMS সফটওয়্যার

  • MySQL, PostgreSQL, Oracle, and Microsoft SQL Server, along with NoSQL options like MongoDB and Redis

RDBMS কি? (উদাহরণসহ)

RDBMS (Relational Database Management System) হলো এমন একটি ডাটাবেস ব্যবস্থাপনা ব্যবস্থা যেখানে ডেটা টেবিল (Table) আকারে সংরক্ষণ করা হয় এবং টেবিলগুলোর মধ্যে সম্পর্ক (Relation) থাকে।

সহজ ভাষায়—
👉 সম্পর্কযুক্ত টেবিলের মাধ্যমে ডেটা সংরক্ষণ ও পরিচালনা করার পদ্ধতিকে RDBMS বলে।


🔹 RDBMS-এর বৈশিষ্ট্য

  1. ডেটা টেবিল আকারে সংরক্ষণ করা হয়

  2. প্রতিটি টেবিলে Primary Key থাকে

  3. টেবিলগুলোর মধ্যে Foreign Key দ্বারা সম্পর্ক তৈরি হয়

  4. SQL (Structured Query Language) ব্যবহার করা হয়

  5. ডেটা পুনরাবৃত্তি (Redundancy) কম হয়


🔹 উদাহরণ

 উদাহরণ ১: স্কুল ডাটাবেস



এখানে Roll নম্বরের মাধ্যমে দুইটি টেবিলের মধ্যে সম্পর্ক তৈরি হয়েছে।
এটাই RDBMS-এর মূল ধারণা।


🔹 জনপ্রিয় RDBMS সফটওয়্যার

  • MySQL

  • PostgreSQL

  • Oracle Database

  • Microsoft SQL Server

Difference Between DBMS and RDBMS



///////////////////////////////Break//////////

Table (টেবিল)

Table হলো সারি (Record) ও কলাম (Field) দিয়ে গঠিত একটি কাঠামো যেখানে ডেটা সংরক্ষণ করা হয়।


Record (রেকর্ড)

Record হলো টেবিলের একটি সম্পূর্ণ সারি।

Field (ফিল্ড)

Field হলো টেবিলের একটি কলাম।
প্রতিটি Field-এর একটি নাম ও Data Type থাকে।

এখানে —
Roll একটি Field
Name একটি Field
Age একটি Field

Data Types (ডেটা টাইপ)

Data Type নির্ধারণ করে একটি ফিল্ডে কী ধরনের তথ্য সংরক্ষণ করা যাবে।


/////////////////10 minute exam///////////////////

Use online Editor to create table: 
https://www.programiz.com/sql/online-compiler

create a student table with 5 field in sql


CREATE TABLE Student (
    Roll INT,
    Name VARCHAR(50),
    Class INT,
    Age INT,
    Address VARCHAR(100)
);

Insert Data into table

INSERT INTO Student (Roll, Name, Class, Age, Address)
VALUES (101, 'Rahim', 10, 15, 'Dhaka');

Add Multiple Values;

INSERT INTO Student (Roll, Name, Class, Age, Address)
VALUES (101, 'Rahim', 10, 15, 'Dhaka'),
(101, 'Rahim', 10, 15, 'Dhaka'),
(101, 'Rahim', 10, 15, 'Dhaka'),
(101, 'Rahim', 10, 15, 'Dhaka')
;

SELECT (ডেটা দেখার জন্য)

SELECT কমান্ড টেবিল থেকে ডেটা দেখানোর জন্য ব্যবহৃত হয়।

সব ডেটা দেখাতে

SELECT * FROM Student;

নির্দিষ্ট ফিল্ড দেখাতে

SELECT Name, Age FROM Student;

শর্তসহ (WHERE ব্যবহার করে)

SELECT * FROM Student WHERE Class = 10;

///////////////try more condition

UPDATE (ডেটা পরিবর্তন করার জন্য)

UPDATE কমান্ড টেবিলের বিদ্যমান ডেটা পরিবর্তন করতে ব্যবহৃত হয়।

UPDATE Student SET Age = 16 WHERE Roll = 101;

DELETE (ডেটা মুছে ফেলার জন্য)

DELETE কমান্ড টেবিল থেকে রেকর্ড মুছে ফেলতে ব্যবহৃত হয়।

DELETE FROM Student WHERE Roll = 101;

Delete table from Database

DROP TABLE table_name;

Key (কি)

Key হলো টেবিলের এমন একটি বা একাধিক ফিল্ড যা একটি রেকর্ডকে সনাক্ত (identify) করতে ব্যবহৃত হয়।

👉 সহজভাবে: টেবিলের ডেটা খুঁজে বের করার বিশেষ চিহ্নই হলো Key।

কির বিভিন্ন ধরন আছে, যেমন—

  • Primary Key

  • Foreign Key

  • Candidate Key

  • Composite Key

Primary Key (প্রাইমারি কী)

Primary Key হলো এমন একটি ফিল্ড যা প্রতিটি রেকর্ডকে আলাদাভাবে সনাক্ত করে।

🔹 বৈশিষ্ট্য

✔ Unique (একই মান দুইবার হবে না)
✔ Null হতে পারে না
✔ একটি টেবিলে একটি Primary Key থাকে (একাধিক ফিল্ড মিলেও হতে পারে)

🔹 উদাহরণ

Student Table

Roll (PK)    Name    Class
    101    Rahim    10
    102    Karim    10

এখানে Roll হলো Primary Key কারণ—

  • প্রতিটি ছাত্রের রোল আলাদা

  • রোল নম্বর ফাঁকা (Null) হতে পারে না


3) Foreign Key (ফরেন কী)

Foreign Key হলো এমন একটি ফিল্ড যা অন্য টেবিলের Primary Key–এর সাথে সম্পর্ক তৈরি করে।

👉 এটি টেবিলগুলোর মধ্যে সম্পর্ক (Relation) স্থাপন করে।

🔹 উদাহরণ

Student Table

    
Roll (PK)Name
            101                    Rahim
            102                        Karim

Result Table

Roll (FK)    Marks
    101    85
    102    90

এখানে Result টেবিলের Roll হলো Foreign Key,
কারণ এটি Student টেবিলের Primary Key–এর সাথে সম্পর্কিত।

এক লাইনে মনে রাখা

Key: রেকর্ড সনাক্ত করার জন্য ব্যবহৃত ফিল্ড।
Primary Key: ইউনিক ও নালবিহীন শনাক্তকারী।
Foreign Key: অন্য টেবিলের Primary Key–এর সাথে সম্পর্ক তৈরি করে এমন ফিল্ড।


Student Table with Primary Key

CREATE TABLE Student (

    Roll INT PRIMARY KEY,

    Name VARCHAR(50) NOT NULL,

    Class INT,

    Age INT,

    Address VARCHAR(100)

);

Result Table with Foreign Key

CREATE TABLE Result (
    ResultID INT PRIMARY KEY,
    Roll INT,
    Subject VARCHAR(50),
    Marks INT,
    FOREIGN KEY (Roll) REFERENCES Student(Roll)
);

Insert Record into student table

INSERT INTO Student (Roll, Name, Class, Age, Address)
VALUES (101, 'Rahim', 10, 15, 'Dhaka'),
       (102, 'Karim', 10, 16, 'Chittagong');

Insert Record into Result table

INSERT INTO Result (ResultID, Roll, Subject, Marks)
VALUES (1, 101, 'Math', 85),
       (2, 101, 'English', 90),
       (3, 102, 'Math', 80);

Select data from both table

SELECT 
    Student.Roll, 
    Student.Name, 
    Student.Class, 
    Result.Subject, 
    Result.Marks
FROM Student
LEFT JOIN Result
ON Student.Roll = Result.Roll;

//////////*********Discuses Relationship************///////

Types of Database Relationships

Database relationships can be broadly categorized into four types, each serving a specific purpose in connecting data. Understanding these types is crucial for designing efficient and meaningful 

1. One-to-one (1:1) relationships

A one-to-one relationship connects one record in a table to exactly one record in another table. This is often used when splitting data into multiple tables for better organization or security.

Use Case: In a healthcare database, a "Patients" table may have a one-to-one relationship with a "Medical Records" table. Each patient is linked to a unique medical record, ensuring sensitive health information is stored separately.

2. One-to-many (1:N) or many-to-one (N:1) relationships

In a one-to-many relationship, a single record in one table can be associated with multiple records in another table. This is one of the most common relationship types in relational databases.

Use case: An "Authors" table might connect to a "Books" table, where each author can have multiple books attributed to them.

3. Many-to-many (N: N) relationships

A many-to-many relationship occurs when multiple records in one table are related to multiple records in another table. This is implemented using a junction table to manage the connections.

Use case: In an education system, students can enroll in multiple courses, and each course can have multiple students. A "Student-Course" junction table is used to connect the "Students" and "Courses" tables.

-------------------------------------------------------------------------

NoSQL databases

-----------------------------------------------------------------------------------------------------------------------
NoSQL databases are non-relational systems designed to handle large volumes of unstructured or semi-structured data. Unlike traditional SQL databases, they offer flexible schemas and scale horizontally across many servers.




Comments

Popular posts from this blog

Basic Web Design with HTML and CSS

Web Design JavaScript