#Day_3 of my SQL journey: The CRUD Practice 3 TIPS
Bieng a web dev, you don't need to know every SQL command. You just need to master CRUD.
The Breakdown:
-CREATE: INSERT INTO users (name) VALUES ('Gemini');
-READ: SELECT * FROM users;
-UPDATE: UPDATE users SET status = 'Active' WHERE id = 1;
-DELETE: DELETE FROM users WHERE id = 1;
3 Tips for your CRUD Practice today
-Dry Run Rule: Before you run a DELETE or UPDATE query, run it as a SELECT first. If the SELECT shows the right rows, then change it to the destructive command.
-Comparison Note: While you practice, notice that PostgreSQL uses SERIAL for auto-incrementing IDs, while MySQL uses AUTO_INCREMENT.
Little nuances like this make great "Did you know?" posts.
-Constraint Awareness: Try to delete a row that is linked to another table (a Foreign Key).
Watch it fail. Understanding why it fails is a huge level-up in database design.
#SQL #BuildInPublic #CodeNewbie #WebDev