Swapna Kumar Panda
Swapna Kumar Panda

@swapnakpanda

13 تغريدة 14 قراءة Nov 08, 2022
SQL Commands, explained
➤ DDL
➤ DML
➤ DQL
➤ DCL
➤ TCL
Introduction to SQL
⬘ SQL stands for Structured Query Language.
⬗ SQL is a computer language for storing, manipulating, and retrieving data in a relational database.
⬙ SQL provides useful commands for performing these operations.
⬖ These commands are put into 5 categories
➊ DDL
DDL ➟ Data Definition Language
⬘ DDL commands are used to define the database schema.
⬗ DDL is a set of SQL commands that are used to create, modify, and delete database structures but not data.
⬙ List of DDL Commands
➤ CREATE
Used to create the database or its objects (like Table, Views, Stored Procedures, Index, etc.)
➤ DROP
Used to delete objects from the database.
➤ ALTER
Used to alter the structure of the database.
➤ TRUNCATE
Used to remove all records from a table, including all spaces allocated for the records.
➤ RENAME
Used to rename an object already existing in the database.
➤ COMMENT
Used to add comments to the data dictionary.
➋ DML
DML ➟ Data Manipulation Language
⬘ DML commands are used to manipulate the data present in the database.
⬙ List of DML Commands
➤ INSERT
Used to insert data into a table.
➤ UPDATE
Used to update existing data within a table.
➤ DELETE
Used to delete records from a database table.
➤ LOCK
Used to control the concurrency on a table.
➤ CALL
Used to call a PL/SQL code.
➤ EXPLAIN PLAN
To describe the access path to data.
➌ DQL
DQL ➟ Data Query Language
⬘ DQL commands are used for performing queries on the data within schema objects.
⬙ List of DQL Commands
➤ SELECT
Used to retrieve data from the database.
➍ DCL
DCL ➟ Data Control Language
⬘ DCL commands mainly deal with the rights, permissions, and other controls of the database system.
⬙ List of DCL Commands
➤ GRANT
To give users access privileges to the database.
➤ REVOKE
To withdraw the user’s access privileges.
➎ TCL
TCL ➟ Transaction Control Language
⬘ TCL commands deal with the transaction within the database.
⬙ List of TCL Commands
❍ COMMIT
Used to commit a transaction.
➤ ROLLBACK
Used to rollback a transaction in case of any error occurs.
➤ SAVEPOINT
Used to set a savepoint within a transaction.
➤ SET TRANSACTION
Used to specify characteristics for the transaction.
🏁 Final Words
⬘ We saw how SQL uses certain commands to carry out the required task.
⬙ We categorized all commands into 5 categories.
Let's summarize all these in a diagram.
Hello 👋
I am a Tech Writer, Educator, and Mentor from India 🇮🇳
I am sharing
❯ Tutorials
❯ Career Tips
❯ Interview Questions
❯ Project Ideas
on
➠ Web Development
➠ Data Structures and Algo
➠ Databases
Do you find this content useful? Share your feedback 🗨️

جاري تحميل الاقتراحات...