MERN ์Šคํƒ ํ•™์Šต 83์ผ์ฐจ

์ž‘์„ฑ์ž

์นดํ…Œ๊ณ ๋ฆฌ:

โ† ํ”ผ๋“œ๋กœ
DEV Community ยท Ali Hamza ยท 2026-06-27 ๊ฐœ๋ฐœ(SW)

Ali Hamza

Hello Dev Community! ๐Ÿ‘‹

It 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! ๐Ÿ› ๏ธโšก

In 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.

๐Ÿง  Core Structural Mechanisms I Mastered on Day 83

As written inside my query workflow configurations across “Screenshot (183).png” and “Screenshot (184).png”, I broken down the commands into explicit application blocks:

1. The Multi-Tool of Database Schemas: ALTER TABLE

Instead of dropping a full table and losing existing production rows just to add or fix a property field, ALTER allows real-time schema evolution:

  • ADD COLUMN: Injected brand new attribute constraints cleanly into live systems.
  • DROP COLUMN: Trimmed away unused memory fields to keep datasets optimized.
  • MODIFY COLUMN: Changed underlying data typings dynamically (e.g., shifting lengths of string column variables).
  • RENAME COLUMN: Rewrote structural column aliases for better domain design naming compliance.

2. The High-Speed Reset Button: TRUNCATE TABLE

One of the most important optimization concepts I learned today is the critical difference between DELETE FROM and TRUNCATE:

  • DELETE FROM scans and deletes rows one-by-one sequentially, triggering heavy transactional database logs.
  • 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!

๐Ÿ› ๏ธ Operational Look at the Day 83 Script Setup

Here is a conceptual look at how I executed these dynamic schema evolutions inside my daily work session:


sql
-- Evolving table schemas fluidly without wiping structures
ALTER TABLE student_directory ADD COLUMN student_age INT NOT NULL DEFAULT 18;
ALTER TABLE student_directory MODIFY COLUMN student_name VARCHAR(50);
ALTER TABLE student_directory RENAME COLUMN marks TO exam_score;
ALTER TABLE student_directory DROP COLUMN legacy_address;

-- Instant operational garbage collection reset
TRUNCATE TABLE staging_logs;

Enter fullscreen mode Exit fullscreen mode

์›๋ฌธ์—์„œ ๊ณ„์† โ†—

์ถ”์ถœ ๋ณธ๋ฌธ ยท ์ถœ์ฒ˜: dev.to ยท https://dev.to/ali_hamza_589ec7b3eb6688d/day-83-of-learning-mern-stack-3njl

์ฝ”๋ฉ˜ํŠธ

๋‹ต๊ธ€ ๋‚จ๊ธฐ๊ธฐ

์ด๋ฉ”์ผ ์ฃผ์†Œ๋Š” ๊ณต๊ฐœ๋˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค. ํ•„์ˆ˜ ํ•„๋“œ๋Š” *๋กœ ํ‘œ์‹œ๋ฉ๋‹ˆ๋‹ค