Tables — Complete Guide
Tables — Complete Guide: free step-by-step lesson with examples, common mistakes, and interview tips — part of MySQL Tutorial on Toolliyo Academy.
On this page
MySQL Tutorial · Lesson 7 of 100
Tables
Basics → Advanced
Basics · 1 — SQL · ~6 min · MySQL — Foundations
What is this?
Tables store rows of data with named columns and fixed types. CREATE TABLE defines structure; INSERT adds rows. InnoDB stores the clustered index with the primary key.
Why should you care?
A Swiggy order line, a Flipkart SKU, and a bank ledger entry each map to rows in a well-named table — bad table design slows every feature.
See it live — copy this example
Run in MySQL Workbench or the mysql CLI.
USE DataFlow;
CREATE TABLE IF NOT EXISTS customers (
customer_id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
full_name VARCHAR(120) NOT NULL,
city VARCHAR(60),
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
What happened?
- customer_id auto-increments and is the primary key.
- full_name is required; city optional.
- created_at defaults to insert time.
- This is the base table for many DataFlow queries later.
Practice next
- Run the CREATE TABLE in Workbench.
- Run DESCRIBE customers; to see columns.
- Insert one row: INSERT INTO customers (full_name, city) VALUES ('Priya Sharma', 'Pune');
- Add email VARCHAR(190) UNIQUE NOT NULL and insert a duplicate to see the error.
- Run SHOW CREATE TABLE customers\G for exact DDL.
Remember
Tables = columns + rows. PRIMARY KEY defines InnoDB row order. DESCRIBE shows structure quickly.
DataFlow customer signup
Registration API inserts one row into customers when a user completes OTP.
Outcome: Every downstream order links via customer_id.
Interview prep for this lesson
Practice these questions aloud after reading—each links to a full structured answer.
Sign in to ask a question or upvote helpful answers.
No questions yet — be the first to ask!