Advanced MySQL Operations: Auto-Increment, Indexes, Foreign Keys, and Data Manipulation
Auto-Increment Configuration
The default behavior for auto-increment columns starts at 1 and increments by 1. However, specific scenarios may require customizing the starting point or the increment step.
Setting the Initial Value
ALTER TABLE records AUTO_INCREMENT = 100;
Adjusting the Increment Step
Session Scope: Affects only the current con ...
Posted on Mon, 03 Aug 2026 16:51:50 +0000 by fandelem
Database Schema Creation and SQL Query Exercises
Creating Database Tables and Relationshpis
-- Create class table and insert data
CREATE TABLE classes (
class_id INT AUTO_INCREMENT PRIMARY KEY,
class_name VARCHAR(32) NOT NULL DEFAULT ""
) CHARSET utf8;
INSERT INTO classes (class_name) VALUES
("Grade 3 Class 2"), ("Grade 1 Class 3"), ("Grade 3 Class ...
Posted on Sat, 18 Jul 2026 16:10:46 +0000 by mblack0508
Foreign Keys, Table Relationships, and Multi-Table Queries in MySQL
Foreign Keys
Why Foreign Keys?
Before foreign keys, merging every thing into one table caused issues:
Unclear focus: Hard to separate employee vs. department data.
Redundant storage: Same fields repeated across rows.
Poor scalability: Changing one part affected the whole table.
Solution: Split into multiple tables (e.g., emp and dep) and use ...
Posted on Thu, 16 Jul 2026 17:27:07 +0000 by marmite