DAY 25 - Come Home with SQL Query Command Types
Photo by Mandy Glynn

DAY 25 - Come Home with SQL Query Command Types

CLICK HERE for the "Learn Something New Every Day" 30-day project introduction


There are five types of SQL Query Command Types.?Knowing what the purpose of these are and what types of commands are included can help you to understand what you are really doing with your code (like not permanently deleting something when you didn't mean to).?It can also help you to read the code of others and understand what is going on.

I love to compare new things I learn with things I already know about.?This helps create multiple connections to new material and makes it easier to understand and access at a later time (if you have read many of my articles, you will know that I am HUGE on making connections).

For today I am comparing databases and data to your house.?The house is the database structure, and the data is all the things you put into it to make it your home.

SQL Query Command Types are how we interact with the house in our daily lives.

DDL: Data Definition Language

BUILDING/REMODELING THE HOUSE.?This is building the house based on blueprints.?It can also be building an addition or tearing down a deck -you still have what is in your house, but you have changed the structure.?In your database, this creates and modifies the structure, but doesn't necessarily change the data if you already have it there.

COMMANDS: CREATE, ALTER, DROP, TRUNCATE, COMMENT, RENAME

?

DML: Data Manipulation Language

FURNISHING THE HOUSE.?This is adding/removing/changing things like furniture or dishes to your home that will make it useful to live there.?In your database, this is how you modify the actual data.

COMMANDS: INSERT, UPDATE, MERGE, DELETE, LOCK, CALL, EXPLAIN PLAN

?

DQL: Data Query Language

USING YOUR STUFF. You use the items you have furnished your house with.?This is cooking on your stove, making new, exciting meals with the ingredients you placed there.?In your database, this is how you use your data, how you call it up and order it in ways that make sense and are useful to you.

COMMANDS: SELECT

?

TCL: Transaction Control Language

PERMANENCE.?This is making a change permanent in your home, like if you want to permanently install a bookshelf by screwing it into a wall instead of just placing it there.?In your database, since the updates that DML commands make can be canceled before the session is closed, this can help make the changes permanent as well as gives the opportunity to undo them and return to a previous state if completed in error.

COMMANDS: SET TRANSACTION, COMMIT, SAVEPOINT, ROLLBACK

?

DCL: Data Control Language

SECURITY. In your house it is how you keep intruders out and allow the people who have permission to come in.?It is the deadbolt on the front door and the selective distribution of keys. In your database, this is how you control access to the database.

COMMANDS: GRANT, REVOKE

?

I hope this helps you remember and understand the types that SQL commands are categorized into.?While this isn't necessary to learn how to use SQL, it is useful for setting a solid foundation of understanding to build your SQL house on!

?

https://towardsdatascience.com/5-tips-for-learning-sql-in-2022-573822fe3f92

https://www.geeksforgeeks.org/sql-ddl-dql-dml-dcl-tcl-commands/


As always, stay Inquisitive, my friends!

要查看或添加评论,请登录

Mandy Glynn的更多文章

  • DAY 27 - Putative is a 4-letter-word

    DAY 27 - Putative is a 4-letter-word

    CLICK HERE for the "Learn Something New Every Day" 30-day project introduction Today I am going back to my English…

  • DAY 26 - Playlist for the Laid-off

    DAY 26 - Playlist for the Laid-off

    CLICK HERE for the "Learn Something New Every Day" 30-day project introduction Today's thing I learned (I discovered…

  • DAY 24 - An Abridged Guide to Starting on the SQL Path

    DAY 24 - An Abridged Guide to Starting on the SQL Path

    CLICK HERE for the "Learn Something New Every Day" 30-day project introduction I am one of the types of people that…

    6 条评论
  • DAY 23 - UNIONs and JOINs: SQL Partnerships Where Two Become One

    DAY 23 - UNIONs and JOINs: SQL Partnerships Where Two Become One

    CLICK HERE for the "Learn Something New Every Day" 30-day project introduction I am currently going through the…

    4 条评论
  • DAY 22 - To EXISTS or IN, that is the (SQL) Question

    DAY 22 - To EXISTS or IN, that is the (SQL) Question

    I was casually perusing LinkedIn this morning and stumbled upon a post about writing good SQL vs just writing a query…

    3 条评论
  • DAY 21 - Learn Thyself!

    DAY 21 - Learn Thyself!

    CLICK HERE for the "Learn Something New Every Day" 30-day project introduction Tonight I got to present at an event…

    3 条评论
  • DAY 20 - Where has all the data gone??

    DAY 20 - Where has all the data gone??

    CLICK HERE for the "Learn Something New Every Day" 30-day project introduction This entry will be a little bit…

  • DAY 19 - Going up! Elevator Pitches

    DAY 19 - Going up! Elevator Pitches

    CLICK HERE for the "Learn Something New Every Day" 30-day project introduction I have been working on fine-tuning our…

  • DAY 18 - The Exhaustion of a Having a Great Time

    DAY 18 - The Exhaustion of a Having a Great Time

    CLICK HERE for the "Learn Something New Every Day" 30-day project introduction Once a month I participate with a great…

  • DAY 17 - MINTER IS COMING

    DAY 17 - MINTER IS COMING

    Move over, pumpkin spice -it's one of my favorite days of the year! Minter is coming. It's the day I can find…

社区洞察

其他会员也浏览了