Skip to main content

Day 32 – MySQL Database & Tables (Using phpMyAdmin)

Published 5 min readMarkdown

🎯 Day 32 Goal

By the end of this day, students will clearly understand:

  • What is a Database

  • Why we create multiple databases

  • What is a Table

  • Rows & Columns in real life

  • What is phpMyAdmin

  • How to:

    • Create a database

    • Create tables

    • Insert basic data (concept level)

πŸ‘‰ Today is foundation day for CRUD


πŸ” Quick Revision (From Day 31)

  • MySQL = Relational Database

  • Data is stored in tables

  • MySQL Server runs in background

  • We connect using tools (GUI / Node.js)

Today we go one level deeper πŸ‘‡


🧠 What Is a Database? (Very Simple)

A database is a container that holds tables.

🏫 Real-Life Example

School System

Real LifeMySQL
School buildingDatabase
Class roomsTables
StudentsRows
Name, Roll NoColumns

πŸ‘‰ One database can have many tables


πŸ—‚οΈ Why We Create Separate Databases?

Because every project is different.

Examples:

  • school_db

  • hospital_db

  • railway_db

  • todo_app_db

πŸ‘‰ This keeps data:

  • Organized

  • Secure

  • Easy to manage


πŸ–₯️ What Is phpMyAdmin?

πŸ“Œ Simple Definition

phpMyAdmin is a web-based GUI tool to manage MySQL databases.

Instead of terminal commands:

  • We use browser

  • Click & manage databases easily

πŸ‘‰ Very beginner-friendly πŸ‘


πŸ”§ Why We Are Using phpMyAdmin (Instead of Workbench)

phpMyAdminMySQL Workbench
Web-basedDesktop app
Easy for beginnersSlightly heavy
Comes with XAMPPSeparate install
Good for learningGood for professionals

πŸ‘‰ phpMyAdmin is perfect for teaching students


🧩 How phpMyAdmin Works (Concept)

Browser β†’ phpMyAdmin β†’ MySQL Server β†’ Database

phpMyAdmin is just a middle tool, not a database itself.


πŸš€ Creating a Database (Step-by-Step)

🟒 Step 1: Open phpMyAdmin

Usually:

http://localhost/phpmyadmin

🟒 Step 2: Click on β€œNew”

This means β†’ Create new database

🟒 Step 3: Enter Database Name

Example:

todo_app_db

🟒 Step 4: Click β€œCreate”

πŸŽ‰ Database created successfully


🧠 Important Naming Rules (Teach Students)

βœ” Use lowercase
βœ” Use underscore _
βœ” No spaces

❌ Todo App
βœ… todo_app_db


πŸ“Š What Is a Table?

A table stores actual data.

Database β†’ Container
Table β†’ Data holder


🧾 Real-Life Example: Todo App

Table Name: tasks

ColumnMeaning
idUnique number
titleTask name
statusPending / Done
created_atDate

🧱 Table Structure Explained

Columns (Fields)

  • Fixed structure

  • Same for all rows

Rows (Records)

  • Actual data

  • Can be many


πŸ› οΈ Creating a Table in phpMyAdmin

🟒 Step 1

Select database β†’ todo_app_db

🟒 Step 2

Click Create Table

Table name:

tasks

Number of columns:

4

🧠 Understanding Column Properties (Very Important)

1️⃣ Column Name

Example:

id

2️⃣ Data Type

Defines what kind of data is stored

Examples:

  • INT β†’ Numbers

  • VARCHAR β†’ Text

  • DATE β†’ Date

3️⃣ Length

Max size of data

Example:

VARCHAR(255)

πŸ“˜ Common Data Types (Must Teach)

Data TypeUse
INTNumbers
VARCHARText
TEXTLong text
DATEDate only
DATETIMEDate + Time
BOOLEANTrue / False

πŸ”‘ Primary Key (Most Important Concept)

What Is Primary Key?

  • Unique identifier

  • No duplicate values

  • No NULL allowed

Example:

id

πŸ‘‰ Every table must have a primary key


🧠 Auto Increment (Explain Slowly)

Auto Increment means:

  • MySQL automatically increases number

Example:

1, 2, 3, 4...

Perfect for:

  • User ID

  • Task ID

  • Order ID


🧾 Example Table Structure (Conceptual)

tasks table

ColumnTypeExtra
idINTPK, Auto Increment
titleVARCHAR(255)Not Null
statusVARCHAR(20)Default: pending
created_atDATETIMECurrent time

βž• Inserting Data (Using phpMyAdmin)

phpMyAdmin provides Insert tab

Example record:

  • title β†’ Learn MySQL

  • status β†’ pending

πŸ‘‰ Row gets added automatically


🧠 How This Helps in Node.js

Later in Node.js:

  • We will fetch rows

  • Insert new tasks

  • Update status

  • Delete tasks

πŸ‘‰ Database structure is foundation of backend


πŸ—οΈ Professional Tip (Very Important)

Before writing backend code:

  • Always design database

  • Decide tables & columns

Professionals do DB design first, coding later.


🧠 Day 32 Key Takeaways

βœ” Database = Container
βœ” Table = Data storage
βœ” Rows = Records
βœ” Columns = Fields
βœ” phpMyAdmin = Easy GUI tool
βœ” Primary Key is mandatory


πŸ“… What We Will Learn on Day 33

πŸ‘‰ SQL queries (SELECT, INSERT, UPDATE, DELETE)
πŸ‘‰ Real CRUD using phpMyAdmin
πŸ‘‰ Prepare for Node.js connection


πŸŽ“ Homework for Students (Optional)

1️⃣ Create database: school_db
2️⃣ Create table: students
3️⃣ Add columns:

  • id

  • name

  • class

  • phone


πŸ”” Stay Connected

If you found this article helpful and want to receive more such beginner-friendly and industry-relevant Node JS notes, tutorials, and project ideas β€” πŸ“© Subscribe to our newsletter by entering your email below.

And if you're someone who wants to prepare for tech interviews while having a little fun and entertainment, πŸŽ₯ Don’t forget to subscribe to my YouTube channel – Knowledge Factory 22 – for regular content on tech concepts, career tips, and coding insights!

Stay curious. Keep building. πŸš€

About the author

  • Hi there, tech enthusiasts! I'm a passionate Software Developer driven by a love for continuous learning and innovation. I thrive on exploring new tools and technologies, pushing boundaries, and finding creative solutions to complex problems. What You'll Find Here On my Hashnode blog, I share: πŸš€ In-depth explorations of emerging technologies πŸ’‘ Practical tutorials and how-to guides πŸ”§Insights on software development best practices πŸš€Reviews of the latest tools and frameworks πŸ’‘ Personal experiences from real-world projects. Join me as we bridge imagination and implementation in the tech world. Whether you're a seasoned pro or just starting out, there's always something new to discover! Let’s connect and grow together! 🌟

No comments yet. Be the first to comment.

More from this blog