“Maybe It’s You.” Choosing Your One True SQL: PostgreSQL🐘 vs MySQL 🐬
- Sarah Rashidi
- Apr 29
- 4 min read
Updated: May 4
“I’m not a ‘maybe.’ I’m the one.” — Joe Goldberg, YOU
Hey Techies! Today We're tackling SQL and don’t worry, you don’t need serial-killer focus to master databases. You just need the right first step. This guide strips SQL down to the basics and shows how the two most popular databases PostgreSQL and MySQL handle the same beginner tasks.
What is SQL, really?
SQL (Structured Query Language) is a powerful programming language specifically designed for managing and interacting with data stored in relational databases. It allows us to organize, access, analyze, and update information efficiently.
Imagine a database as a digital library. Within this library, each table is like a bookshelf focused on a specific topic such as customer information or product inventory. Columns define the type of data stored (like names, dates, or prices), while rows represent individual records.
To retrieve or manipulate data, we write SQL queries, which act as precise instructions to the database, much like asking a librarian for specific books or details.
For instance, a query can request all orders placed in the last month or update a customer’s contact information.
SQL Is the Language, But Who’s Listening?
SQL is the language we use to communicate with databases but there’s more to the story.
SQL itself doesn’t store data; instead, it works within database management systems (DBMSs) software tools that store, manage, and give structure to your data.
Some of the most commonly used DBMSs include:
PostgreSQL 🐘 – open-source, powerful, and known for advanced features and standards compliance
MySQL 🐬 – fast, reliable, and widely used, especially for web applications
SQLite – lightweight and serverless, great for small projects or apps
Oracle Database – enterprise-level with robust features and high performance
Microsoft SQL Server – often used in enterprise environments, especially on Windows
Today, we’ll be comparing PostgreSQL and MySQL, two of the most popular and widely adopted systems, and showing you how to set each one up in under five minutes.
Setting Up (The 5-Minute Version)
To get started quickly, follow these steps based on your choice of DBMS:
Install the DBMS
For PostgreSQL: sudo apt install postgresql
For MySQL: sudo apt install mysql-server
Open a database prompt
PostgreSQL: psql -U postgres
MySQL: mysql -u root -p
Create a test databaseRun the following command in either prompt:CREATE DATABASE library;
Now you're ready to begin writing SQL queries and working with your new database.
First Table & First Rows
Step 1: Create the Table
This will create a table called books with 4 columns:
id: the unique ID for each book (auto-generated)
title: the name of the book
author: who wrote it
year_pub: the year it was published
If you're using PostgreSQL 🐘, run:
CREATE TABLE books (
id SERIAL PRIMARY KEY,
title VARCHAR(100),
author VARCHAR(100),
year_pub INT
);
If you're using MySQL 🐬, run:
CREATE TABLE books (
id INT AUTO_INCREMENT PRIMARY KEY,
title VARCHAR(100),
author VARCHAR(100),
year_pub INT
);
Step 2: Insert Some Books into the Table
Same code works for both PostgreSQL and MySQL!
INSERT INTO books (title, author, year_pub) VALUES
('1984', 'George Orwell', 1949),
('The Pragmatic Programmer', 'Hunt & Thomas', 1999);
Key Difference Reminder
PostgreSQL uses SERIAL or GENERATED AS IDENTITY to auto-number the id field.
MySQL uses AUTO_INCREMENT for the same thing.
Reading Data (Your Bread-and-Butter Commands)
Goal | SQL Command | What It Does |
Show every row | SELECT * FROM books; | Lists the full table. |
Show only titles | SELECT title FROM books; | One column. |
Filter rows | SELECT * FROM books WHERE year_pub < 2000; | Adds a simple condition. |
Sort results | SELECT * FROM books ORDER BY year_pub DESC; | Newest first. |
Limit results | SELECT * FROM books LIMIT 2; | Shows two rows works the same in both DBs. |
That’s 95 % of what you’ll do as a beginner.
Spot-the-Difference Cheat Sheet
Feature | PostgreSQL | MySQL |
Auto-IDs | SERIAL / IDENTITY | AUTO_INCREMENT |
Text vs Quotes | "double_quotes" around mixed-case identifiers | `backticks` (or leave names lowercase) |
Case sensitivity | Sensitive if you use quotes | Usually case-insensitive on Windows/Mac |
Default charset | UTF-8 out of the box | UTF-8 in recent versions (set with utf8mb4) |
Backups | pg_dump | mysqldump |
Truth bomb: for beginner projects these differences won’t block you.
Which One Should You Choose?
Pick PostgreSQL 🐘 if… | Pick MySQL 🐬 if… |
You want “advanced later” (geo, JSON indexing). | You’re following a LAMP / WordPress tutorial. |
You like stricter rules (it yells when you break them). | You just need something light and everywhere. |
You enjoy its big open-source extension scene. | Your cheap hosting provider already gives you MySQL. |
Wrapping Up (No Stalking Required)
SQL isn’t scary. With five basic commands (CREATE, INSERT, SELECT, UPDATE, DELETE) you can already build a project portfolio, whether you’re storing recipes or tracking expenses.
So “Maybe it’s you.” Time to choose your first SQL partner and start coding. Questions? Ping me on LinkedIn. I’m here to help… just a lot less creepy than Joe.
And with that, we reach the end of the blog. I hope you had a good read and learned a lot. Stay tuned as we'll cover more tech-related topics in future blogs.
In case of any questions or suggestions, feel free to reach out to me via LinkedIn. I'm always open to fruitful discussions.🍏🦜
Comments