If you write PHP and keep seeing SQLite, MySQL, and PostgreSQL thrown around, it’s easy to feel like you missed a secret class in school.
You just want to store data and run queries without frying your brain.
Let’s walk through the basics step by step, using only what’s in the source, and keep it practical.
What Problem Are We Solving (And Who Is This For)?
This is for you if:
- You write PHP (or web stuff) and need a database.
- You keep hearing “use MySQL”, “PostgreSQL is better”, “SQLite is enough”, but they all blur together.
- You’re not fully clear on what a database vs DBMS vs RDBMS actually is.
We’re not doing deep theory.
We’re just building enough understanding so that when you pick SQLite, MySQL, or PostgreSQL, you know what you’re dealing with and what “relational” actually means.
No benchmarks, no performance charts, no marketing speak.
Just the core concepts from the source, put into a practical workflow.
Step 1: Get Clear On “Database” vs “DBMS”
First thing: people say “database” for everything, but that’s not quite right.
The source is very specific here.
Database:
- Any collection of data.
- Could be on paper, in Excel, in a text file, or inside a server.
- It doesn’t have to be on a computer at all.
Database Management System (DBMS):
- A computer program that interacts with a database.
- It lets you control access, write data, run queries, and handle management tasks.
So when someone says:
- “I installed a database” – they usually mean they installed a DBMS.
- “My database crashed” – often it’s the DBMS process or its storage that failed.
Why this matters for you as a PHP dev:
- Your PHP code doesn’t talk directly to a “pile of data”.
- It talks to DBMS software (like SQLite, MySQL, PostgreSQL) which then handles the actual data.
If you keep that mental model clean, debugging becomes easier: “Is my problem PHP → DBMS, or DBMS → actual data?”
Step 2: Understand What Makes a DBMS “Relational”
The source focuses on relational database management systems (RDBMS).
That “relational” word is the key difference.
An RDBMS is just a DBMS that uses the relational data model.
In this model:
- Data is organized into tables.
- A table is more formally called a relation.
- A row in that table is a tuple.
- A column in that table is an attribute.
In simpler terms:
- Relation = table
- Tuple = row
- Attribute = column
All rows in a table share the same set of columns (attributes).
That gives you consistency: every row in the users table, for example, has the same structure.
Why this is useful in your projects:
- Your PHP code can rely on table structure: same columns, same types.
- You can write predictable queries because the table shape is stable.
So when someone says “relational database”, think: data organized in tables with consistent rows and columns.
Step 3: Meet SQL (And Its “Dialects”) The Practical Way
Most relational databases use SQL (Structured Query Language) to manage and query data.
That includes systems like SQLite, MySQL, and PostgreSQL.
From the source:
- Many RDBMSs use their own dialect of SQL.
- These dialects may have limitations or extensions.
- Extensions usually provide extra features beyond standard SQL.
So you’ve got two layers to think about:
- Standard SQL
- Defined by ANSI, ISO, and IEC.
- There is a current SQL standard (like SQL:2011 mentioned in the source).
- It’s large and complex.
- SQL dialects
- SQLite, MySQL, PostgreSQL all implement SQL.
- But each adds its own details and sometimes leaves out bits.
Practically:
- Basic things like
SELECT,INSERT,UPDATE,DELETE, and simpleWHEREusually look similar. - More advanced stuff can differ across systems (syntax changes, certain features missing or extended).
When you write queries as a PHP dev, it’s good to keep in mind:
- You’re writing SQL for a specific DBMS, not some abstract excellent SQL.
- If you switch from one system to another, some queries might need changes.
Step 4: See Where SQLite, MySQL, and PostgreSQL Fit Conceptually
The source talks about SQLite, MySQL, and PostgreSQL as three widely implemented open-source RDBMSs.
Even without going into performance or features, we can put them into a simple picture.
What they have in common:
- All three are database management systems (DBMSs).
- All three are relational (RDBMS): they use tables/relations, rows/tuples, columns/attributes.
- All three use SQL with their own dialects.
So at the core, when you:
- Define a table
- Add rows
- Query with
SELECT
…you’re using the same fundamental relational idea in all three systems.
From a PHP developer’s daily work point of view, this means:
- If you understand tables, rows, columns, and basic SQL in one of them, the core concepts transfer to the others.
- The differences are in details and features, but the relational foundation is the same.
Step 5: Build a Simple Mental Model You Can Use in Code
Let’s glue it all together into something you can keep in your head while coding.
This is how to “think” about your database setup when you’re working with PHP.
- You have data you want to store
- Example: users, orders, blog posts.
- That data is your database in the broad sense.
- You pick an RDBMS (SQLite / MySQL / PostgreSQL)
- This is your DBMS: the software that manages that data.
- It lets you define tables (relations) and interact with them.
- You design tables (relations)
- Think in terms of tables like
users,orders,posts. - Each table = relation.
- You define columns (attributes)
usersmight haveid,email,password_hash.- Each column = attribute.
- You store rows (tuples)
- Each user is one row in
users. - Each row = tuple.
- You use SQL to talk to the DBMS
- Insert:
INSERT INTO users (...) VALUES (...); -
Query:
SELECT * FROM users WHERE email = ...; - Remember your SQL is a dialect
- The DBMS you use (SQLite / MySQL / PostgreSQL) understands a specific flavor of SQL.
- Basic operations are similar; special features vary.
If you keep this mental “stack” clear, jumping between different RDBMSs is a lot less stressful.
Step 6: Practical Safety Habits When Working With Any RDBMS
Even though the source doesn’t go into admin tasks, a few simple habits will save you a lot of pain when dealing with SQLite/MySQL/PostgreSQL from your PHP projects.
These don’t depend on extra facts; they just apply the ideas you already saw.
- Backup before destructive changes
- You’re dealing with tables, rows, and columns that your app depends on.
- Before dropping or altering tables, make sure you have a copy of the data the DBMS is managing.
- Use a separate environment for experiments
- Because your DBMS strictly manages your data, bad SQL can wipe important rows.
- Test your table structure and queries on a non-production copy when possible.
- Be careful with broad queries
- A
DELETEorUPDATEwithoutWHEREaffects all tuples in a relation (all rows in a table). - Double-check your conditions and which table/relation you’re running it on.
These habits respect the structure of relational systems: relations, tuples, and attributes are very literal.
If you target the wrong one, the DBMS will happily do exactly what you told it.
Step 7: Summary – What You Should Walk Away With
Quick recap of the essentials from the source, in everyday language:
- Database: any collection of data, on or off a computer.
- DBMS: program that manages and lets you interact with a database.
- RDBMS: a DBMS that uses the relational model (tables/relations, rows/tuples, columns/attributes).
- SQLite, MySQL, PostgreSQL: three widely used open-source RDBMSs.
- SQL: language used to manage and query data in relational databases.
- SQL dialects: each RDBMS has its own flavor of SQL, with its own extensions and limitations.
- Standard SQL: defined by ANSI/ISO/IEC; the full standard is large and complex.
If you understand that structure, you’re already ahead of many developers who just treat “the database” as a black box.
From here, you can start writing and refining SQL for your chosen RDBMS with a clearer picture of what’s going on under the hood.
Need more help? Check the latest CrushEdge posts.
No Comments