SQL vs NoSQL
Two shops can sell the same goods and keep their records in different ways. One keeps strict ledgers with fixed columns. The other keeps a folder for each customer, and each folder can hold different papers. Neither way is better for every shop.
5 min read5 মিনিটে পড়া যায় · 7 sections7টি সেকশন · 6 sources6টি সোর্স · updated Nov 2026আপডেট: Nov 2026
In plain words
A relational (SQL) database keeps data in tables with rows and columns. The columns hold attributes, and the rows hold values Source 1সোর্স 1. A key links rows of one table to rows of another table, and one SQL query can read both Source 1সোর্স 1.
A non-relational (NoSQL) database uses other data models. The common ones are key-value, document, and graph Source 1সোর্স 1. A document database stores JSON-like objects that can have a nested shape Source 1সোর্স 1.
The names are a simplification. "NoSQL" names a group of systems with many data models Source 1সোর্স 1, and they are not all alike. So the useful question is not "which one wins" but "what does my data look like, and how will the application read it".
সহজ English
A relational (SQL) database keeps data in tables with rows and columns. The columns hold attributes. The rows hold values Source 1সোর্স 1. A key links rows of one table to rows of another table. One SQL query can read both Source 1সোর্স 1.
A non-relational (NoSQL) database uses other data models. The common ones are key-value, document, and graph Source 1সোর্স 1. A document database stores JSON-like objects. These objects can have a nested shape Source 1সোর্স 1.
The names are a simplification. "NoSQL" names a group of systems with many data models Source 1সোর্স 1. They are not all alike. So do not ask "which one wins". Ask "what does my data look like, and how will the application read it".
বাংলা ব্যাখ্যা
রিলেশনাল (SQL) ডেটাবেস ডেটা রাখে টেবিলে, যেখানে রো আর কলাম থাকে। কলামে থাকে অ্যাট্রিবিউট, আর রো-তে থাকে ভ্যালু Source 1সোর্স 1। একটি কী (key) এক টেবিলের রো-কে অন্য টেবিলের রো-র সঙ্গে যুক্ত করে। একটি SQL কোয়েরি দুটোই পড়তে পারে Source 1সোর্স 1।
নন-রিলেশনাল (NoSQL) ডেটাবেস অন্য ডেটা মডেল ব্যবহার করে। সাধারণ মডেল হলো key-value, ডকুমেন্ট আর গ্রাফ Source 1সোর্স 1। ডকুমেন্ট ডেটাবেস JSON-এর মতো অবজেক্ট রাখে। এই অবজেক্টের গঠন নেস্টেড (nested) হতে পারে Source 1সোর্স 1।
নাম দুটি একটি সরলীকরণ। "NoSQL" অনেক ডেটা মডেলের একদল সিস্টেমকে বোঝায় Source 1সোর্স 1। সেগুলো সব একরকম নয়। তাই "কোনটি জিতবে" জিজ্ঞেস করবেন না। জিজ্ঞেস করুন, "আমার ডেটা দেখতে কেমন, আর অ্যাপ্লিকেশন কীভাবে তা পড়বে"।
When you need it
You meet this choice when a team plans a new service, when a feature changes the shape of the data, or when a database starts to slow down. A tester needs it to know which promises the database keeps and which promises the application must keep.
সহজ English
You meet this choice in three cases. A team plans a new service. A feature changes the shape of the data. A database starts to slow down. A tester needs to know this choice. Then the tester knows which promises the database keeps and which promises the application must keep.
বাংলা ব্যাখ্যা
তিনটি ক্ষেত্রে আপনি এই বাছাইয়ের মুখোমুখি হন। একটি দল নতুন সার্ভিসের পরিকল্পনা করে। একটি ফিচার ডেটার গঠন বদলে দেয়। একটি ডেটাবেস ধীর হতে শুরু করে। টেস্টারের এই বাছাই জানা দরকার। তাহলে সে বুঝতে পারে ডেটাবেস কোন প্রতিশ্রুতি রাখে আর অ্যাপ্লিকেশনকে কোন প্রতিশ্রুতি রাখতে হবে।
A real-life example
A learning platform stores students, courses, and enrollments.
- Enrollments and payments. Each student row links to course rows, and a failed payment must not leave half an enrollment. This fits a relational design with keys and transactions.
- Course catalog pages. Each course has different fields: a video course has a length, a lab course has a tool list. A document database can keep each course as one document with its own fields.
The platform can use both. This example is the tutorial's own.
সহজ English
A learning platform stores students, courses, and enrollments.
- Enrollments and payments. Each student row links to course rows. A failed payment must not leave half an enrollment. This fits a relational design with keys and transactions.
- Course catalog pages. Each course has different fields. A video course has a length. A lab course has a tool list. A document database can keep each course as one document with its own fields.
The platform can use both. This example is the tutorial's own.
বাংলা ব্যাখ্যা
একটি লার্নিং প্ল্যাটফর্ম স্টুডেন্ট, কোর্স আর এনরোলমেন্ট রাখে।
- এনরোলমেন্ট আর পেমেন্ট। প্রতিটি স্টুডেন্টের রো একাধিক কোর্সের রো-র সঙ্গে যুক্ত। একটি ফেইল হওয়া পেমেন্ট যেন অর্ধেক এনরোলমেন্ট রেখে না যায়। এটি কী (key) আর ট্রানজেকশন সহ একটি রিলেশনাল ডিজাইনের সঙ্গে মেলে।
- কোর্স ক্যাটালগের পাতা। প্রতিটি কোর্সের ফিল্ড আলাদা। একটি ভিডিও কোর্সের দৈর্ঘ্য আছে। একটি ল্যাব কোর্সের টুলের তালিকা আছে। একটি ডকুমেন্ট ডেটাবেস প্রতিটি কোর্সকে নিজস্ব ফিল্ড সহ একটি ডকুমেন্ট হিসেবে রাখতে পারে।
প্ল্যাটফর্ম দুটোই ব্যবহার করতে পারে। এই উদাহরণ টিউটোরিয়ালের নিজস্ব।
Trade-offs
The choice depends on the data and on the access pattern. The table shows where the vendor docs say the two sides differ.
| Question | Relational (SQL) | Non-relational (NoSQL) |
|---|---|---|
| Structure | Tables with strict rules for data and relations Source 1সোর্স 1 | More flexible, for data that changes Source 1সোর্স 1 |
| Schema | Set before you insert data Source 4সোর্স 4 | Documents in one collection can have different fields Source 4সোর্স 4 |
| Rules in the database | Constraints such as primary key, foreign key, unique, check, and not-null Source 2সোর্স 2 | In MongoDB, optional validation rules, added where you need them Source 4সোর্স 4Source 5সোর্স 5 |
| Transactions | Several steps are all-or-nothing Source 3সোর্স 3 | In MongoDB, a single-document write is atomic. Multi-document transactions exist too, with a performance cost in most cases Source 6সোর্স 6 |
| Consistency model | Strict ACID Source 1সোর্স 1 | Often BASE, with eventual consistency Source 1সোর্স 1 |
| Scaling | Usually vertical. Read-only load can be copied to more servers. Horizontal scaling of read-write workloads needs partitioning or sharding Source 1সোর্স 1 | Spread the load across many nodes more easily Source 1সোর্স 1 |
| Related data | Joins across tables Source 4সোর্স 4 | In MongoDB, embed related data, or reference it Source 4সোর্স 4 |
Three points need care:
- No side is "all or nothing" on integrity. Some NoSQL databases offer ACID, with trade-offs in performance or other areas Source 1সোর্স 1. MongoDB supports ACID transactions Source 6সোর্স 6.
- A flexible schema is not a missing schema. MongoDB lets you add validation rules to a collection. By default it rejects an insert or update that breaks them Source 5সোর্স 5.
- The model follows the access pattern. MongoDB advises to design the model from the access patterns of the application, and to keep together the data that is accessed together Source 4সোর্স 4.
A rule of thumb, the tutorial's own: if your data is stable and its relations matter, start with relational. If the shape varies or one very large workload must spread over many nodes, look at NoSQL. Treat this as a first guess, not a rule.
সহজ English
The choice depends on the data and on the access pattern. This list shows where the vendor docs say the two sides differ. Each item gives the relational side first, then the non-relational side.
- Structure. Relational: tables with strict rules for data and relations Source 1সোর্স 1. NoSQL: more flexible, for data that changes Source 1সোর্স 1.
- Schema. Relational: you set it before you insert data Source 4সোর্স 4. NoSQL: documents in one collection can have different fields Source 4সোর্স 4.
- Rules in the database. Relational: constraints such as primary key, foreign key, unique, check, and not-null Source 2সোর্স 2. NoSQL: in MongoDB, optional validation rules, which you add where you need them Source 4সোর্স 4Source 5সোর্স 5.
- Transactions. Relational: several steps are all-or-nothing Source 3সোর্স 3. NoSQL: in MongoDB, a single-document write is atomic. Multi-document transactions exist too, with a performance cost in most cases Source 6সোর্স 6.
- Consistency model. Relational: strict ACID Source 1সোর্স 1. NoSQL: often BASE, with eventual consistency Source 1সোর্স 1.
- Scaling. Relational: usually vertical. Read-only load can be copied to more servers. Horizontal scaling of read-write workloads needs partitioning or sharding Source 1সোর্স 1. NoSQL: spreads the load across many nodes more easily Source 1সোর্স 1.
- Related data. Relational: joins across tables Source 4সোর্স 4. NoSQL: in MongoDB, embed related data, or reference it Source 4সোর্স 4.
Three points need care:
- No side is "all or nothing" on integrity. Some NoSQL databases offer ACID, with trade-offs in performance or other areas Source 1সোর্স 1. MongoDB supports ACID transactions Source 6সোর্স 6.
- A flexible schema is not a missing schema. MongoDB lets you add validation rules to a collection. By default it rejects an insert or update that breaks them Source 5সোর্স 5.
- The model follows the access pattern. MongoDB advises to design the model from the access patterns of the application. It also advises to keep together the data that is accessed together Source 4সোর্স 4.
A rule of thumb, the tutorial's own: if your data is stable and its relations matter, start with relational. If the shape varies or one very large workload must spread over many nodes, look at NoSQL. Treat this as a first guess, not a rule.
বাংলা ব্যাখ্যা
বাছাই নির্ভর করে ডেটা আর অ্যাক্সেস প্যাটার্নের (access pattern) উপর। এই তালিকা দেখায়, ভেন্ডরের ডকুমেন্টেশন অনুযায়ী দুই পক্ষ কোথায় আলাদা। প্রতিটি বিষয়ে আগে রিলেশনাল পক্ষ, তারপর নন-রিলেশনাল পক্ষ দেওয়া হলো।
- গঠন। রিলেশনাল: ডেটা আর সম্পর্কের জন্য কঠোর নিয়মের টেবিল Source 1সোর্স 1। NoSQL: বদলাতে থাকা ডেটার জন্য আরও নমনীয় Source 1সোর্স 1।
- স্কিমা। রিলেশনাল: ডেটা ইনসার্ট করার আগে এটি ঠিক করতে হয় Source 4সোর্স 4। NoSQL: একই কালেকশনের ডকুমেন্টে আলাদা ফিল্ড থাকতে পারে Source 4সোর্স 4।
- ডেটাবেসের নিয়ম। রিলেশনাল: primary key, foreign key, unique, check আর not-null-এর মতো কনস্ট্রেইন্ট Source 2সোর্স 2। NoSQL: MongoDB-তে ঐচ্ছিক ভ্যালিডেশন রুল, যা আপনি যেখানে দরকার সেখানে যোগ করেন Source 4সোর্স 4Source 5সোর্স 5।
- ট্রানজেকশন। রিলেশনাল: কয়েকটি ধাপ সব-অথবা-কিছুই-নয় (all-or-nothing) Source 3সোর্স 3। NoSQL: MongoDB-তে একটি সিঙ্গেল-ডকুমেন্ট রাইট অ্যাটমিক (atomic)। মাল্টি-ডকুমেন্ট ট্রানজেকশনও আছে, বেশিরভাগ ক্ষেত্রে পারফরম্যান্সের খরচ সহ Source 6সোর্স 6।
- কনসিসটেন্সি মডেল। রিলেশনাল: কঠোর ACID Source 1সোর্স 1। NoSQL: প্রায়ই BASE, ইভেন্চুয়াল কনসিসটেন্সি (eventual consistency) সহ Source 1সোর্স 1।
- স্কেলিং। রিলেশনাল: সাধারণত ভার্টিক্যাল। শুধু পড়ার লোড আরও সার্ভারে কপি করা যায়। পড়া-লেখা দুই ধরনের কাজের হরাইজন্টাল স্কেলিংয়ে পার্টিশনিং বা শার্ডিং লাগে Source 1সোর্স 1। NoSQL: লোড অনেক নোডে আরও সহজে ছড়িয়ে দেয় Source 1সোর্স 1।
- সম্পর্কিত ডেটা। রিলেশনাল: টেবিল জুড়ে জয়েন Source 4সোর্স 4। NoSQL: MongoDB-তে সম্পর্কিত ডেটা এম্বেড করুন, অথবা রেফারেন্স করুন Source 4সোর্স 4।
তিনটি বিষয়ে সতর্ক থাকতে হবে:
- ইন্টেগ্রিটির ক্ষেত্রে কোনো পক্ষই "সব অথবা কিছুই নয়" নয়। কিছু NoSQL ডেটাবেস ACID দেয়, তবে পারফরম্যান্স বা অন্য ক্ষেত্রে কিছু ছাড় দিয়ে Source 1সোর্স 1। MongoDB ACID ট্রানজেকশন সমর্থন করে Source 6সোর্স 6।
- নমনীয় স্কিমা মানে স্কিমা নেই, তা নয়। MongoDB আপনাকে একটি কালেকশনে ভ্যালিডেশন রুল যোগ করতে দেয়। ডিফল্টভাবে এই রুল ভাঙে এমন ইনসার্ট বা আপডেট সে প্রত্যাখ্যান করে Source 5সোর্স 5।
- মডেল অনুসরণ করে অ্যাক্সেস প্যাটার্ন। MongoDB পরামর্শ দেয়, অ্যাপ্লিকেশনের অ্যাক্সেস প্যাটার্ন থেকে মডেল ঠিক করুন। এটি আরও পরামর্শ দেয়, যে ডেটা একসঙ্গে অ্যাক্সেস করা হয়, তা একসঙ্গে রাখুন Source 4সোর্স 4।
একটি মোটামুটি নিয়ম (rule of thumb), টিউটোরিয়ালের নিজস্ব: আপনার ডেটা স্থির হলে এবং তার সম্পর্ক গুরুত্বপূর্ণ হলে রিলেশনাল দিয়ে শুরু করুন। গঠন একেক রকম হলে, বা একটি খুব বড় ওয়ার্কলোড অনেক নোডে ছড়াতে হলে, NoSQL দেখুন। এটিকে প্রথম অনুমান হিসেবে নিন, নিয়ম হিসেবে নয়।
Common mistakes
- Choosing by fashion. Pick from the data and the queries, not from a trend.
- Thinking a flexible schema means no rules. In MongoDB you can add validation rules Source 5সোর্স 5. Without them, the application must keep the data in shape. This second point is the tutorial's own advice.
- Thinking SQL cannot scale. The vendor says it needs extra strategies for write scaling, not that it cannot Source 1সোর্স 1.
- Using one rule for every service. One system can use a relational database for some data and a document database for other data.
- Assuming a transaction works the same everywhere. Check what the chosen database guarantees Source 6সোর্স 6.
সহজ English
- Choosing by fashion. Pick from the data and the queries, not from a trend.
- Thinking a flexible schema means no rules. In MongoDB you can add validation rules Source 5সোর্স 5. Without them, the application must keep the data in shape. This second point is the tutorial's own advice.
- Thinking SQL cannot scale. The vendor says it needs extra strategies for write scaling, not that it cannot Source 1সোর্স 1.
- Using one rule for every service. One system can use a relational database for some data and a document database for other data.
- Assuming a transaction works the same everywhere. Check what the chosen database guarantees Source 6সোর্স 6.
বাংলা ব্যাখ্যা
- ফ্যাশন দেখে বাছাই করা। ডেটা আর কোয়েরি দেখে বাছাই করুন, ট্রেন্ড দেখে নয়।
- নমনীয় স্কিমা মানে কোনো নিয়ম নেই, এমন ভাবা। MongoDB-তে আপনি ভ্যালিডেশন রুল যোগ করতে পারেন Source 5সোর্স 5। সেগুলো না থাকলে অ্যাপ্লিকেশনকে ডেটা ঠিক গঠনে রাখতে হবে। এই দ্বিতীয় কথাটি টিউটোরিয়ালের নিজস্ব পরামর্শ।
- SQL স্কেল করতে পারে না, এমন ভাবা। ভেন্ডর বলে, রাইট স্কেলিংয়ের জন্য তার বাড়তি কৌশল লাগে, এমন নয় যে সে পারে না Source 1সোর্স 1।
- সব সার্ভিসে একই নিয়ম ব্যবহার করা। একটি সিস্টেম কিছু ডেটার জন্য রিলেশনাল ডেটাবেস আর অন্য ডেটার জন্য ডকুমেন্ট ডেটাবেস ব্যবহার করতে পারে।
- ধরে নেওয়া যে ট্রানজেকশন সব জায়গায় একইভাবে কাজ করে। বেছে নেওয়া ডেটাবেস কী নিশ্চিত করে, তা যাচাই করুন Source 6সোর্স 6।
What a tester can check
Tutorial advice
These test ideas are the tutorial's own advice.
- Ask which promises the database keeps. Is a multi-step change all-or-nothing, or does the application handle it?
- Try bad data. Insert a missing value, a wrong type, or a duplicate. See whether the database or the application rejects it.
- Test old data. In a flexible schema, old records may lack new fields. Open one.
- Test stale reads. With eventual consistency, read right after a write, from another connection. Check what the user sees.
- Test a failure halfway. Stop a multi-step change in the middle. Look for half-saved data.
সহজ English
These test ideas are the tutorial's own advice.
- Ask which promises the database keeps. Is a multi-step change all-or-nothing, or does the application handle it?
- Try bad data. Insert a missing value, a wrong type, or a duplicate. See whether the database or the application rejects it.
- Test old data. In a flexible schema, old records may lack new fields. Open one.
- Test stale reads. With eventual consistency, read right after a write, from another connection. Check what the user sees.
- Test a failure halfway. Stop a multi-step change in the middle. Look for half-saved data.
বাংলা ব্যাখ্যা
এই টেস্টের ধারণাগুলো টিউটোরিয়ালের নিজস্ব পরামর্শ।
- জিজ্ঞেস করুন ডেটাবেস কোন প্রতিশ্রুতি রাখে। একটি বহু-ধাপের পরিবর্তন কি all-or-nothing, নাকি অ্যাপ্লিকেশন তা সামলায়?
- খারাপ ডেটা দিয়ে চেষ্টা করুন। একটি অনুপস্থিত ভ্যালু, ভুল টাইপ, বা ডুপ্লিকেট ইনসার্ট করুন। দেখুন ডেটাবেস প্রত্যাখ্যান করে, নাকি অ্যাপ্লিকেশন।
- পুরনো ডেটা টেস্ট করুন। নমনীয় স্কিমাতে পুরনো রেকর্ডে নতুন ফিল্ড না-ও থাকতে পারে। একটি খুলে দেখুন।
- স্টেল রিড (stale read) টেস্ট করুন। ইভেন্চুয়াল কনসিসটেন্সি থাকলে রাইটের ঠিক পরে অন্য কানেকশন থেকে পড়ুন। ইউজার কী দেখে তা যাচাই করুন।
- মাঝপথে ফেইলিউর টেস্ট করুন। একটি বহু-ধাপের পরিবর্তন মাঝখানে থামিয়ে দিন। অর্ধেক-সংরক্ষিত ডেটা খুঁজুন।
Key words
| Word | Meaning |
|---|---|
| Relational database | Stores data in tables with rows and columns, linked by keys Source 1সোর্স 1 |
| NoSQL | A group of non-relational models, such as key-value, document, and graph Source 1সোর্স 1 |
| Schema | The structure of the data (the tutorial's own plain definition). A relational table sets it before inserts Source 4সোর্স 4 |
| Constraint | A rule that the database enforces on a column or table Source 2সোর্স 2 |
| Transaction | Several steps that act as one all-or-nothing operation Source 3সোর্স 3 |
| Eventual consistency | The state changes over time and later becomes consistent Source 1সোর্স 1 |