{
"$type": "site.standard.document",
"bskyPostRef": {
"cid": "bafyreig5so5tl2gg6o6slmlkqs5zi7pmyyovqkds2nz7tvkiqdu3vsg7hi",
"uri": "at://did:plc:25rdn5elo5izoxrmtis34zuk/app.bsky.feed.post/3mpbm7h4bftd2"
},
"coverImage": {
"$type": "blob",
"ref": {
"$link": "bafkreihsbgr4z25ygqixt4oiw36m6racoklrdr3s4z4ep5lccqi5jsmcxu"
},
"mimeType": "image/webp",
"size": 47272
},
"path": "/ali_hamza_589ec7b3eb6688d/day-83-of-learning-mern-stack-3njl",
"publishedAt": "2026-06-27T13:22:36.000Z",
"site": "https://dev.to",
"tags": [
"sql",
"backend",
"database",
"softwareengineering"
],
"textContent": "Hello Dev Community! 👋\n\nIt is officially **Day 83** of my 100-day full-stack and database engineering streak! Yesterday, I mastered DML mutations like UPDATE and DELETE to alter dataset rows. Today, I leveled up by stepping back into **DDL (Data Definition Language)** to modify the actual structural blueprint of my tables using: **ALTER TABLE and TRUNCATE TABLE!** 🛠️⚡\n\nIn real-world production setups, business requirements change constantly. You might need to inject a new user status column, drop an obsolete configuration tracking row, or wipe staging test logs instantly. Today, I engineered those exact operations.\n\n## 🧠 Core Structural Mechanisms I Mastered on Day 83\n\nAs written inside my query workflow configurations across **\"Screenshot (183).png\"** and **\"Screenshot (184).png\"** , I broken down the commands into explicit application blocks:\n\n### 1. The Multi-Tool of Database Schemas: `ALTER TABLE`\n\nInstead of dropping a full table and losing existing production rows just to add or fix a property field, `ALTER` allows real-time schema evolution:\n\n * **`ADD COLUMN`:** Injected brand new attribute constraints cleanly into live systems.\n * **`DROP COLUMN`:** Trimmed away unused memory fields to keep datasets optimized.\n * **`MODIFY COLUMN`:** Changed underlying data typings dynamically (e.g., shifting lengths of string column variables).\n * **`RENAME COLUMN`:** Rewrote structural column aliases for better domain design naming compliance.\n\n\n\n### 2. The High-Speed Reset Button: `TRUNCATE TABLE`\n\nOne of the most important optimization concepts I learned today is the critical difference between `DELETE FROM` and `TRUNCATE`:\n\n * `DELETE FROM` scans and deletes rows one-by-one sequentially, triggering heavy transactional database logs.\n * **`TRUNCATE`** drops the underlying storage layout data and instantly re-creates a blank schema template. It wipes out all record collections in a fraction of a millisecond while preserving the original table columns intact!\n\n\n\n## 🛠️ Operational Look at the Day 83 Script Setup\n\nHere is a conceptual look at how I executed these dynamic schema evolutions inside my daily work session:\n\n\n sql\n -- Evolving table schemas fluidly without wiping structures\n ALTER TABLE student_directory ADD COLUMN student_age INT NOT NULL DEFAULT 18;\n ALTER TABLE student_directory MODIFY COLUMN student_name VARCHAR(50);\n ALTER TABLE student_directory RENAME COLUMN marks TO exam_score;\n ALTER TABLE student_directory DROP COLUMN legacy_address;\n\n -- Instant operational garbage collection reset\n TRUNCATE TABLE staging_logs;\n",
"title": "Day 83 of Learning MERN Stack"
}