Other RDBMS — SQLite, SQL Server & Oracle
অন্যান্য RDBMS — SQLite, SQL Server, Oracle
1. Beyond Postgres and MySQL
The two giants of open-source RDBMS — Postgres and MySQL — share the spotlight, but you will absolutely meet three other engines in your career: SQLite (the most-deployed database in the world, sitting inside every smartphone, browser, IoT device), Microsoft SQL Server (every mid-to-large Bangladeshi enterprise running .NET / Microsoft stack), and Oracle Database (banks, telcos, and most legacy ERP systems including those of several Bangladeshi banks).
We'll close with a cross-DB portability cheat sheet — what's standard SQL (works everywhere) and what's vendor-specific — and a decision matrix to help you pick.
2. SQLite — The Most-Deployed Database on Earth
SQLite is not a server. It is a tiny C library — about 800 KB — that opens a file and exposes a SQL interface on top of it. No daemon, no port, no users, no backup utility. It is shipped inside applications. Every Android phone, every iPhone, every Chrome browser, every Firefox, every WhatsApp client, every Skype, every aircraft (Airbus uses it on the A350) and every Bangla Express bus ticket app you've ever used — they all carry SQLite quietly inside.
.db ফাইল।
2.1 Architecture & quirks
| Property | SQLite | Why it matters |
|---|---|---|
| Deployment | One file (app.db) + one library. | No DBA, no service to crash. |
| Concurrency | One writer at a time; many readers. | Bad for multi-tenant servers; perfect for single-user apps. |
| Type system | "Type affinity" — values keep their declared affinity but can hold others. | You can put text into an INTEGER column. Surprising, mostly harmless. |
| Foreign keys | Off by default! Enable with PRAGMA foreign_keys = ON; | Easy footgun — referential integrity silently absent. |
| Transactions | Fully ACID. Default isolation: serializable. | Stronger than most servers' default. |
| Auto-increment | INTEGER PRIMARY KEY auto-increments via ROWID. | No SERIAL / AUTO_INCREMENT keyword needed. |
2.2 WAL mode — for concurrent readers + writer
By default SQLite uses rollback-journal mode: a writer blocks all readers. Switching to WAL mode
(write-ahead log) lets readers proceed in parallel with a writer — at the cost of an extra .db-wal
file. For any app with concurrent access, turn this on.
-- Recommended settings for any production-quality SQLite app
PRAGMA journal_mode = WAL; -- readers + 1 writer concurrent
PRAGMA synchronous = NORMAL; -- fast and safe enough
PRAGMA foreign_keys = ON; -- enforce FK constraints (off by default!)
PRAGMA temp_store = MEMORY; -- temp tables in RAM
-- Sanity check
SELECT sqlite_version() AS ver;
2.3 FTS5 — built-in full-text search
SQLite includes FTS5, a full-text search engine, as a "virtual table" module. For an offline-first app — say a Bangla recipe app with a search box — this is everything you need, no Elasticsearch, no extra service.
-- Create a full-text search virtual table
CREATE VIRTUAL TABLE recipe_fts USING fts5(title, body);
INSERT INTO recipe_fts(title, body) VALUES
('Beef Bhuna', 'A slow cooked spicy Bangladeshi beef curry with onions and ginger.'),
('Chicken Korma', 'A creamy mild dish often served at weddings.'),
('Hilsa Paturi', 'Hilsa fish wrapped in banana leaf with mustard paste.');
-- Search "beef curry" — FTS5 ranks results by relevance
SELECT title, body
FROM recipe_fts
WHERE recipe_fts MATCH 'beef curry'
ORDER BY rank;
MATCH ব্যবহার করে শব্দ-ভিত্তিক search করা যায়; rank দিয়ে
relevance অনুসারে sort। ছোট-মাঝারি app-এর জন্য Elasticsearch বা Solr-এর প্রয়োজন নেই।
2.4 R-tree — spatial / range indexes
SQLite ships an R-tree module — a spatial index for "find shapes that overlap a box." Useful for offline maps, asset bounding boxes, calendar overlap problems.
CREATE VIRTUAL TABLE building_idx USING rtree(
id, min_lng, max_lng, min_lat, max_lat
);
INSERT INTO building_idx VALUES
(1, 90.39, 90.41, 23.78, 23.80), -- Banani area
(2, 90.41, 90.42, 23.81, 23.82); -- Gulshan
-- Buildings whose bounding box overlaps a given query box
SELECT id
FROM building_idx
WHERE max_lng >= 90.40 AND min_lng <= 90.415
AND max_lat >= 23.79 AND min_lat <= 23.80;
3. Microsoft SQL Server & T-SQL
SQL Server is Microsoft's flagship RDBMS, the default choice anywhere a .NET back-end runs. In Bangladesh you'll meet it at corporate banks, large garment ERPs, government MIS systems, and most organisations whose IT department is "Microsoft-shop."
3.1 T-SQL — the dialect
| Concept | T-SQL syntax | Notes |
|---|---|---|
| Auto-increment | id INT IDENTITY(1,1) PRIMARY KEY | vs Postgres SERIAL, MySQL AUTO_INCREMENT, SQLite INTEGER PRIMARY KEY. |
| String concat | 'a' + 'b' | Postgres / SQLite use ||; MySQL uses CONCAT(). |
| LIMIT | SELECT TOP 10 * FROM t or OFFSET … FETCH NEXT 10 ROWS ONLY | No bare LIMIT keyword. |
| Variables | DECLARE @x INT = 5; | The @ sigil is mandatory. |
| IF / control flow | IF … BEGIN … END | No END IF. |
| Date now | GETDATE() or SYSDATETIME() | Postgres / MySQL use NOW() / CURRENT_TIMESTAMP. |
| Schema separator | dbo.MyTable (database.schema.table) | 3-part naming common. |
-- Classic T-SQL stored procedure
CREATE PROCEDURE dbo.GetTopCustomers
@MinSpend DECIMAL(12,2)
AS
BEGIN
SET NOCOUNT ON;
DECLARE @AsOf DATETIME2 = SYSUTCDATETIME();
SELECT TOP 10
c.customer_id,
c.full_name,
SUM(o.amount) AS total_spend,
@AsOf AS as_of
FROM dbo.[order] AS o
JOIN dbo.customer AS c ON c.customer_id = o.customer_id
GROUP BY c.customer_id, c.full_name
HAVING SUM(o.amount) >= @MinSpend
ORDER BY total_spend DESC;
END;
EXEC dbo.GetTopCustomers @MinSpend = 50000;
3.2 Columnstore indexes — analytics inside the OLTP DB
A unique strength: SQL Server's columnstore indexes (clustered or non-clustered) store data column-by-column with heavy compression — so a single SQL Server can serve OLTP rows and aggregate billions of rows for dashboards. (Postgres has columnar via the citus_columnar / external extensions; MySQL has nothing comparable.)
-- A columnstore index over a fact table; analytical queries fly on it
CREATE CLUSTERED COLUMNSTORE INDEX ccx_fact_sales
ON dbo.fact_sales;
-- Same SQL as before; the optimizer chooses the columnstore path
SELECT region, YEAR(order_date) AS yr, SUM(amount) AS revenue
FROM dbo.fact_sales
GROUP BY region, YEAR(order_date);
3.3 Always On Availability Groups
HA in SQL Server is built on Availability Groups — a set of databases failing over together with synchronous or asynchronous replicas, automatic listener routing, and read-only secondaries. The mental model is similar to MySQL's Group Replication or Postgres's Patroni-managed cluster, but tightly integrated with Windows Server Failover Clustering.
3.4 Azure SQL — the cloud cousin
Azure SQL Database and Azure SQL Managed Instance are managed SQL Server offerings on Azure. The dialect is essentially T-SQL with a few unsupported on-prem-only features (cross-database queries on Azure SQL DB, certain CLR features). For a Bangladeshi enterprise migrating to cloud, Azure SQL is often the lowest-friction path off an on-prem SQL Server.
4. Oracle Database — The Enterprise Heavyweight
Oracle Database is the world's most-used enterprise RDBMS by revenue. Banks, telecoms (Grameenphone, Robi historically), air traffic control, large ERPs (Oracle E-Business Suite, PeopleSoft, JD Edwards) — all run on Oracle. Many Bangladeshi banks (e.g. several state-owned and tier-1 private banks) run their core banking on Oracle.
4.1 PL/SQL — Oracle's procedural language
| Feature | PL/SQL | Equivalent elsewhere |
|---|---|---|
| Block | DECLARE … BEGIN … EXCEPTION … END; | Postgres DO $$ … $$; / T-SQL BEGIN … END. |
| Sequences | seq.NEXTVAL | Postgres nextval('seq'). |
| Identity column | id NUMBER GENERATED ALWAYS AS IDENTITY (since 12c) | Same SQL standard as Postgres / SQL Server. |
| Concat / null | NVL(x, 0) = COALESCE(x, 0) | Both work in modern Oracle. |
| Pagination | FETCH FIRST 10 ROWS ONLY (12c+) | Standard SQL, also in PG / SQL Server. |
| Pseudo-row | ROWNUM, ROWID | Oracle-specific; older code uses these. |
| Dual table | SELECT 1 FROM dual | A famous one-row pseudo-table for SELECT without FROM. |
-- Oracle PL/SQL block: process pending orders, with exception handling
DECLARE
v_id orders.id%TYPE;
v_amt orders.amount%TYPE;
n PLS_INTEGER := 0;
BEGIN
FOR rec IN (
SELECT id, amount FROM orders WHERE status = 'PENDING'
) LOOP
BEGIN
UPDATE orders
SET status = 'CONFIRMED', confirmed_at = SYSTIMESTAMP
WHERE id = rec.id;
n := n + 1;
EXCEPTION
WHEN OTHERS THEN
INSERT INTO order_error(order_id, msg, ts)
VALUES (rec.id, SQLERRM, SYSTIMESTAMP);
END;
END LOOP;
DBMS_OUTPUT.PUT_LINE('Processed ' || n || ' orders.');
COMMIT;
END;
/
4.2 AWR & Statspack — Oracle's performance brain
Oracle ships with the Automatic Workload Repository (AWR) — periodic snapshots of every stat the database knows: top SQL by CPU, by I/O, wait events, latch contention. An AWR report is what DBAs call up after any incident. Open-source Statspack is a free predecessor still bundled.
4.3 RAC — Real Application Clusters
Oracle RAC is a shared-storage active/active cluster: many instances on different nodes all reading and writing the same database files via a fast interconnect. It's how Oracle achieves "five-nines" availability for core banking. Operationally complex; license costs are notorious. Postgres and MySQL solve the same problem differently — typically with logical replication and external proxies, not shared storage.
5. Cross-DB SQL Portability — What's Standard, What Isn't
"Standard SQL" sounds reassuring, but every engine has its own dialect. The good news: a large portable subset exists. The bad news: small details bite when you write a query intended to run on multiple engines. Here is the cheat sheet.
| Topic | SQLite | MySQL | PostgreSQL | SQL Server | Oracle |
|---|---|---|---|---|---|
| Auto-increment | INTEGER PRIMARY KEY |
AUTO_INCREMENT |
SERIAL / GENERATED … IDENTITY |
IDENTITY(1,1) |
GENERATED … IDENTITY (12c+) / sequence + trigger |
| String concat | || |
CONCAT(a,b) / + if mode |
|| |
+ or CONCAT() |
|| |
| Now() | CURRENT_TIMESTAMP |
NOW() / CURRENT_TIMESTAMP |
NOW() / CURRENT_TIMESTAMP |
GETDATE() / SYSDATETIME() |
SYSDATE / SYSTIMESTAMP |
| LIMIT / TOP | LIMIT 10 |
LIMIT 10 |
LIMIT 10 / FETCH FIRST 10 |
TOP 10 / FETCH NEXT 10 |
FETCH FIRST 10 ROWS ONLY |
| Coalesce NULL | IFNULL / COALESCE |
IFNULL / COALESCE |
COALESCE |
ISNULL / COALESCE |
NVL / COALESCE |
| Boolean | 0 / 1 (no real BOOLEAN) | BOOLEAN = TINYINT(1) |
Real BOOLEAN |
BIT |
No native; NUMBER(1) or CHAR(1) |
| Recursive CTE | WITH RECURSIVE |
WITH RECURSIVE (8+) |
WITH RECURSIVE |
WITH (recursive marker implicit) |
WITH (implicit) or CONNECT BY (Oracle-only legacy) |
| Quoting identifiers | "name" or [name] |
`name` |
"name" |
[name] or "name" |
"name" |
| Substring | substr(s,1,3) |
SUBSTRING(s,1,3) |
substring(s from 1 for 3) |
SUBSTRING(s,1,3) |
SUBSTR(s,1,3) |
| Date math | date('now','+1 day') |
DATE_ADD(d, INTERVAL 1 DAY) |
d + INTERVAL '1 day' |
DATEADD(day, 1, d) |
d + 1 (DATE) / d + INTERVAL '1' DAY |
JOIN, GROUP BY,
HAVING, CASE, COALESCE — এগুলো প্রায় সব engine-এ এক রকম। বদলায়
auto-increment, string concat, date function, এবং pagination syntax — এই কয়টি জিনিস সাবধানে দেখলেই
আপনার SQL ৯০% portable হয়ে যাবে।
5.1 A portable query — works on all five
-- This query is identical across SQLite, MySQL 8, Postgres, SQL Server, Oracle 12c+
SELECT city,
COUNT(*) AS n_orders,
COALESCE(SUM(amount), 0) AS revenue
FROM orders
GROUP BY city
HAVING SUM(amount) > 25000
ORDER BY revenue DESC;
6. Decision Matrix — Which RDBMS to Choose?
| Scenario | Best fit | Why |
|---|---|---|
| Mobile / desktop app, single user, offline first | SQLite | Zero ops, full ACID, FTS5 + R-tree built in. |
| WordPress / PHP / cPanel hosting | MySQL / MariaDB | Ecosystem default; every plugin assumes it. |
| Modern startup, mixed OLTP + JSON + geo + vectors | PostgreSQL | JSONB, PostGIS, pgvector — one DB does it all. |
| .NET enterprise app on Windows / Azure | SQL Server / Azure SQL | First-class tooling, T-SQL skills abundant locally. |
| Core banking, telco billing, large ERP | Oracle | RAC, partitioning maturity, regulatory comfort. |
| Embedded device (router, car, set-top box) | SQLite | 800 KB library, runs on anything with a filesystem. |
| Read-heavy SaaS at huge scale | PostgreSQL with read replicas, or MySQL + Vitess | Either works; pick by team skills. |
| OLAP / data warehouse | Not in this list — pick BigQuery, Snowflake, ClickHouse, or DuckDB. | Row-store RDBMS struggle past a few TB of analytics. |
7. Glossary (শব্দকোষ)
| Term | Meaning | বাংলায় |
|---|---|---|
| Embedded database | Library linked into the app process; no separate server. | Application-এর ভেতরেই চলে — আলাদা server নেই। |
| WAL mode (SQLite) | Write-ahead log letting readers + 1 writer run in parallel. | Reader ও writer-এর সমান্তরাল চলার জন্য SQLite-এর mode। |
| FTS5 | SQLite's built-in full-text search virtual table. | SQLite-এর ভেতরে full-text search engine। |
| T-SQL | SQL Server's procedural SQL dialect. | SQL Server-এর procedural SQL। |
| Columnstore index | Column-oriented compressed storage for analytics. | Analytics-এর জন্য column-অভিমুখী compressed storage। |
| Always On AG | SQL Server's HA replica-group feature. | SQL Server-এর HA replica গ্রুপ। |
| PL/SQL | Oracle's procedural language. | Oracle-এর procedural ভাষা। |
| AWR | Oracle's automatic performance snapshot system. | Oracle-এর automatic performance snapshot। |
| RAC | Oracle's shared-storage active/active cluster. | Oracle-এর shared-storage active/active cluster। |
| Standard SQL | The portable subset defined by ISO/ANSI. | ISO/ANSI কর্তৃক সংজ্ঞায়িত portable SQL। |
8. Practice Problems
A mix of decision-style questions, dialect translation, and a few SQLite-runnable demos using FTS5 / R-tree.
-
Translate this Postgres-only snippet to T-SQL:
SELECT NOW(), 'Hi ' || name FROM customer LIMIT 5;Postgres-এর snippet-টি T-SQL-এ রূপান্তর করুন।✨ Show Answer
SELECT TOP 5 GETDATE() AS now_ts, 'Hi ' + name AS greeting FROM customer;পরিবর্তিত:
NOW()→GETDATE();||→+;LIMIT 5→TOP 5। -
Translate the same query to Oracle 12c+.একই query Oracle 12c+-এ লিখুন।
✨ Show Answer
SELECT SYSTIMESTAMP AS now_ts, 'Hi ' || name AS greeting FROM customer FETCH FIRST 5 ROWS ONLY; -
A senior dev says "we don't need Elasticsearch for our offline Bangla recipe app — SQLite already does it." Which feature are they referring to and how does it work in one sentence?কোন feature-এর কথা বলছে এবং কীভাবে কাজ করে?
✨ Show Answer
Answer:
FTS5— a built-in virtual-table module that builds an inverted index of tokens at insert/update time and supports theMATCHoperator with relevance ranking, all without leaving SQLite. -
Run the FTS5 demo from §2.3 and modify it to find recipes containing the word "fish."FTS5 demo-তে "fish" শব্দটি খুঁজুন।
✨ Show Answer
ans4.sqlSELECT title FROM recipe_fts WHERE recipe_fts MATCH 'fish' ORDER BY rank; -
Why must you set
PRAGMA foreign_keys = ON;in every SQLite session you care about referential integrity in?SQLite-এ foreign key চালু করতে কী করতে হয় এবং কেন?✨ Show Answer
Answer: SQLite parses FK constraints but does not enforce them by default — for backward compatibility with very old SQLite databases. Each new connection must explicitly enable enforcement with
PRAGMA foreign_keys = ON;. Forgetting this is a classic bug: schemas look correct, integrity is silently absent. -
When would a columnstore index in SQL Server beat a regular B-tree index for a query?SQL Server-এ columnstore কখন B-tree-কে হারায়?
✨ Show Answer
Answer: When the query scans a large fraction of a fact table and aggregates a few columns — e.g.
SUM(amount) GROUP BY regionacross 200M rows. Columnstore reads only the needed columns, in compressed form, and runs vectorized aggregations. B-tree shines for point lookups; columnstore shines for analytics scans. -
Spot the Oracle-only construct:
SELECT 1 FROM dual;. What isdualand what's the equivalent in Postgres?dualকী, এবং Postgres-এ সমতুল্য কী?✨ Show Answer
Answer:
dualis a built-in single-row, single-column table Oracle requires when there's no realFROMtarget (Oracle insists on aFROMclause). In Postgres / SQLite / SQL Server / MySQL you can simply writeSELECT 1;. -
Choose a database and justify in one sentence: a school management system for 30 schools across Bangladesh, run on cheap shared hosting, with non-technical owners.৩০টি স্কুলের জন্য shared hosting-এ system — কোন DB?
✨ Show Answer
Answer: MySQL / MariaDB — every cPanel host has it preinstalled with phpMyAdmin, deployment is one click, and the operational skill bar is the lowest. Postgres would also work but is rarer on shared hosting plans.
-
Choose a database: a large Bangladeshi private bank's core banking system, regulator-audited, must support 24x7 with seconds of failover.Core banking — কোন DB?
✨ Show Answer
Answer: Oracle with RAC + Data Guard. Regulators are familiar with it, the vendor relationship and audit trail exist, and RAC delivers true active/active HA on shared storage. (In greenfield, some banks now consider Postgres + Patroni, but core banking conservatism still favours Oracle.)
-
Choose a database: a desktop Bangla typing tutor that students will install on their own laptops, no internet required.Desktop typing tutor — কোন DB?
✨ Show Answer
Answer: SQLite — bundled with the app, single
.dbfile, zero install, full ACID, FTS5 if needed for lesson search. -
Recursive CTE syntax — write a tiny CTE that lists numbers 1..5. Verify it runs in SQLite (and so equally in Postgres / MySQL 8 / SQL Server / Oracle 12c+).১ থেকে ৫ পর্যন্ত সংখ্যা একটি recursive CTE দিয়ে তৈরি করুন।
✨ Show Answer
ans11.sqlWITH RECURSIVE nums(n) AS ( SELECT 1 UNION ALL SELECT n + 1 FROM nums WHERE n < 5 ) SELECT n FROM nums;In Oracle, drop the keyword
RECURSIVE— Oracle'sWITHinfers it. -
In one paragraph, explain why "write portable SQL" is a goal worth caring about even if you'll only ever ship on one engine.এক RDBMS-এই deploy হলেও portable SQL লেখা কেন গুরুত্বপূর্ণ?
✨ Show Answer
Answer: Because "ever" is longer than you think. Companies switch databases (M&A, cloud migration, cost cutting), test fixtures may run on SQLite while production is Postgres, and reporting tools sometimes target a different engine for analytics. SQL written in the standard subset survives all of these transitions; SQL written with vendor sugar everywhere becomes a re-write project. Portability is also a code-quality signal — you tend to lean on what's expressive (CTEs, window functions, COALESCE) rather than what's lock-in (Oracle's
CONNECT BY, T-SQL's+string concat).
Summary — Module 43
SQLite is the most-deployed database in the world — an embedded library, perfect for single-user and offline apps, with FTS5 and R-tree built in. SQL Server rules the .NET / Microsoft enterprise stack with T-SQL, columnstore indexes for analytics, and Always On Availability Groups for HA. Oracle is the heavyweight of banks, telcos and big ERPs, with PL/SQL, AWR for performance forensics, and RAC for shared-storage HA — paid handsomely for its track record. Underneath, almost all five major engines speak a shared standard SQL subset (CTEs, window functions, joins, group by, COALESCE), and differ in small but real ways for auto-increment, string concatenation, date functions and pagination. Knowing which features are portable and which are vendor-specific is what lets you write SQL that survives migrations and outlives any single product choice.
+) যথাসম্ভব এড়িয়ে চলুন।