β Day 19 of My Cloud Journey β Mastering Advanced MySQL Queries & Concepts for Cloud Projects π§ π οΈ

Table of contents
- π Topics Covered Today:
- 1. π SQL JOINS β Combining Data from Multiple Tables
- 2. π FOREIGN KEYS β Maintaining Data Integrity
- 3. ποΈ DATABASE NORMALIZATION β Keeping Data Clean and Efficient
- 4. β CONSTRAINTS β Validating Data at the DB Level
- 5. π§° BACKUP & RESTORE β Protecting Your Data
- π§ͺ Practical Use Case β Preparing for WordPress Hosting
- π Realizations from Today
- π Whatβs Next?
- π§ Key Terms

After learning the basics of MySQL, today I deep-dived into the advanced features of SQL β the kind that powers real-world applications like WordPress and large-scale cloud-native systems.
Understanding advanced MySQL is essential for anyone building scalable and secure systems on AWS (or any cloud), especially when working with LAMP/LEMP stacks.
π Topics Covered Today:
1. π SQL JOINS β Combining Data from Multiple Tables
SQL JOIN
s allow you to retrieve related data from multiple tables.
πΉ INNER JOIN
SELECT employees.name, departments.dept_name
FROM employees
INNER JOIN departments ON employees.dept_id = departments.id;
Returns only matching records in both tables.
πΉ LEFT JOIN
SELECT employees.name, departments.dept_name
FROM employees
LEFT JOIN departments ON employees.dept_id = departments.id;
Returns all records from the left table and matched records from the right.
πΉ RIGHT JOIN
SELECT employees.name, departments.dept_name
FROM employees
RIGHT JOIN departments ON employees.dept_id = departments.id;
Opposite of LEFT JOIN.
πΉ FULL OUTER JOIN (Not supported in MySQL directly)
SELECT name, dept_name
FROM employees
LEFT JOIN departments ON employees.dept_id = departments.id
UNION
SELECT name, dept_name
FROM employees
RIGHT JOIN departments ON employees.dept_id = departments.id;
2. π FOREIGN KEYS β Maintaining Data Integrity
Foreign keys ensure that the relationship between two tables remains consistent.
CREATE TABLE employees (
id INT PRIMARY KEY,
name VARCHAR(50),
dept_id INT,
FOREIGN KEY (dept_id) REFERENCES departments(id)
);
- Prevents inserting a value in
dept_id
unless it exists indepartments
.
3. ποΈ DATABASE NORMALIZATION β Keeping Data Clean and Efficient
Normalization helps avoid redundancy and inconsistency.
π 1NF: Eliminate Repeating Groups
Each column should have atomic values.
π 2NF: Eliminate Partial Dependency
Every non-key attribute should depend on the whole primary key.
π 3NF: Eliminate Transitive Dependency
Attributes should depend only on the primary key.
π Benefit: Easier updates, consistency, and better performance at scale.
4. β CONSTRAINTS β Validating Data at the DB Level
Constraint | Description |
NOT NULL | Column cannot have NULL value |
UNIQUE | All values must be unique |
DEFAULT | Sets a default value |
CHECK | Limits value range |
PRIMARY KEY | Uniquely identifies each row |
FOREIGN KEY | Creates a link between two tables |
CREATE TABLE users (
id INT PRIMARY KEY,
email VARCHAR(100) UNIQUE NOT NULL,
age INT CHECK (age >= 18)
);
5. π§° BACKUP & RESTORE β Protecting Your Data
πΈ Exporting (Backup):
mysqldump -u root -p mydb > mydb_backup.sql
πΈ Importing (Restore):
mysql -u root -p mydb < mydb_backup.sql
π‘ Always backup before major changes or upgrades!
π§ͺ Practical Use Case β Preparing for WordPress Hosting
Since WordPress uses MySQL as its backend, todayβs learning is crucial before deployment. Iβve created:
A normalized DB schema
Setup foreign keys for posts, users, and categories
Backed up the database for disaster recovery
Understood how WordPress will connect using LAMP/LEMP
π Realizations from Today
SQL is powerful when you understand how tables relate
JOINs and Constraints help build enterprise-grade systems
Backup & normalization are non-negotiable in production
You canβt deploy apps like WordPress effectively without solid DB knowledge
π Whatβs Next?
Day 20 β Iβll deploy WordPress on EC2 using a custom LAMP/LEMP setup:
Setup Apache/Nginx web server
Connect WordPress to a Mariadb database
Explore
wp-config.php
, database creation, and secure deployment
Weβre getting closer to launching real apps from scratch! π―
π§ Key Terms
SQL JOINs (
INNER
,LEFT
,RIGHT
,FULL
)Foreign Keys
Database Normalization (1NF, 2NF, 3NF)
Constraints
Backup & Restore
#Day19 #MySQL #DatabaseDesign #WordPressPrep #JOINs #Normalization #LAMP #LEMP #AWS #DevJourney #90DaysOfCloud #shubhamlondhe
Subscribe to my newsletter
Read articles from Pratik Das directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
