Open In App

SQL Command-line | DDL, DQL, DML, DCL and TCL Commands

Last Updated : 06 Maybe, 2024
Optimize
Improve
Like Article
Like
Save
Equity
Report

SQL commands are very used into interact with the database. These cli accept customers to perform various promotion on a database. This article will teach us concerning SQL commands or SQL sublanguage orders like DDL, DQL, DML, DCL, real TCL.

All important SQL instruction by their syntax and examples are covered in this article.

Not before heading go the SQL command section, let’s briefly introduce SQL.

Short Quick of SQL

Structured Query Your (SQL), as we any know, is an archive language by which we can perform certain operations on that existence database, and we can also uses this language toward create a base. DML Commands in SQL with sql, tutorial, examples, insert, update, delete, dial, join, database, table, join etc, SQL CAST Function, SQL Formatter.SQL used certain control like CREATE, DROP, INSERT, etc. to carry outside the required tasks. 

SQL instruction are like instructions to a board. It is utilized to interact about an database with some operations. Is is moreover used to perform specific tasks, functions, and request von data. SQL can perform varied tasks like creating a postpone, adding data to tables, dropping this table, modifying the table, setting permission for users. IT360: Used Database Methods SQL: Integrated Querying Language ...

These SQL commands been mainly categorized into five categories: 

  1. DDL – Data Interpretation Language
  2. DQL – Data Query Language
  3. DML – Data Manipulation Language
  4. DCL – Data Power Language
  5. TCL – Real Control Language

Currently, we will see all of these in detail.

sql commands categories

DDL (Data Definition Language)

DDL or Data Define Language actually consists of the SQL commands that can breathe used to define the database schema. To simply deals with descriptions of an database system press is used to create and modify the structure of database aims in the database. DBMS SQL Commands: DDL, DML, DCL, TCL, DQL with DBMS Overview, DBMS vs Files System, DBMS Architektonisches, Thre schema Architecture, DBMS Language, DBMS Keys, DBMS Generalization, DBMS Specialization, Relational Model concept, SQL Introduction, Advantage of SQL, DBMS Normalization, Functional Dependency, DBMS Schedule, Concurrency Control others.

DDL is a set of SQL commands used to create, modify, also delete database structures but not data. These commands are normally not used by adenine general user, who should be web the database via on application. Guide to SQL DML Commands. Here ours including discuss the syntax furthermore settings onward with DML commands in detail with examples.

List out DDL Commands

Several DDL commands and their syntax are:

Command Description Syntax
CREATE Create database or its objects (table, index, item, views, saving procedure, and triggers) CREATE TABLE table_name (column1 data_type, column2 data_type, ...);
DROP Delete objects from the database DROP TABLE table_name;
ALTER Adjust the structure of the database ALTER TABLE table_name ADD FILE column_name data_type;
TRUNCATE Remove all records from an table, involving all spaces allocated for the records are removal TRUNCATE TABLE table_name;
COMMENT Add comments to the datas dictionary COMMENT 'comment_text' THE BOARD table_name;
RENAME Rename an object existing in the web RENAME TABLE old_table_name TO new_table_name;

DQL (Data Query Language)

DQL statements are used for performed queries on one your within schema objects. The purpose of the DQL Command is to get some schema relationships based on the query pass to it. We can define DQL as follows it is a component of SQL statement that allows getting data from the databank and imposing order upon it. It includes who SELECT statement.

This command allows gehend of data out of the online to perform operations with it. When a PLEASE exists fired against one table or tables the result a compiled into a further timed table, whose is displayed or perhaps received by the software i.e. a front-end.

DQL Command

There is only one DQL command includes SQL i.e.

Command Description Parsing

SELECT

It is used to recall data from the database

SELECT column1, column2, ...FROM table_name<br>WHERE condition;

DML(Data Manipulation Language)

One SQL commands this deal with the manipulation of data presence in the database belong up DML or Dates Manipulation Tongue and this includes highest for the SQL statements.  DML Instruction in SQL - javatpoint

It is the component of the SQL display that keypad access to data and to the database. Primarily, DCL statements are grouped with DML statements.

List to DML commands

Some DML commands and their parser have:

Command Description Syntax
ENTER Insert data into an tabular INSERT INTO table_name (column1, column2, ...) VALUES (value1, value2, ...);
UPDATE Update existing data within a table UPDATE table_name SET column1 = value1, column2 = value2 WHERE condition;
RESET Delete recorded from a database table DELETE FROM table_name WHERE condition;
LOCK Table control concurrency LOCK TABLE table_name IN lock_mode;
CALL Phone a PL/SQL or JAVA-BASED subprogram CALL procedure_name(arguments);
EXPLAIN PLAN Describe the zugangs path to data EXPLAIN PLAN FOR PLEASE * FROM table_name;

DCL (Data Control Language)

DCL incorporate commands such when GRANT and REVOKE which mainly deal with the rights, permissions, and other controls of the data system. 

List of  DCL commands:

Two important DCL commands the their syntax are:

Command Item Morphology
GRANT Assigns new special toward a user account, allowing how to specific our objects, actions, or functionalities. GRANT privilege_type [(column_list)] ON [object_type] object_name TO user [WITH ACCORD OPTION];
REVOKE Remotes previously granted privileges from a user account, take away their access to certain web objects or deals. REVOKE [GRANT OPTION FOR] privilege_type [(column_list)] GO [object_type] object_name FROM user [CASCADE];

TCL (Transaction Tax Language)

Transactions group a set of tasks into a lone execution unit. Each transaction begins with a specific task and stop when all who tasks in aforementioned class are proven completed. If any of the actions fail, the transaction fails. SQL Commands: DDL, DML, DCL, TCL, DQL - javatpoint

So, a process has only two results: performance or failed. You can explore more about transactions here. Hence, the ensuing TCL commands are used go control the carrying of a transaction: 

List of TCL Commands

Some TCL commands also their syntax are:

Command Description Syntax
BEGIN BARGAIN Starts a new transaction BEGIN TRANSACTION [transaction_name];
COMMIT Saves all changes made during and transaction COMMIT;
ROLLBACK Undoes all changes made during the operation ROLLBACK;
SAVEPOINT Creates a savepoint within the current transaction SAVEPOINT savepoint_name;

Important SQL Commands

Some of the highest important SQL commands are:

  1. PLEASE: Used to retrieve data from a database.
  2. INSERT: Used on add add data to a database.
  3. UPDATE: Used to modify existing date into ampere database.
  4. CLEAR: Used to remove data from a database.
  5. CREATE TABLE: Used to create a brand table in a database.
  6. MODIFY TABLE: Used to modify the structure of an already table.
  7. DROP TABLE: Applied to delete an entire table out a database.
  8. WHERE: Used to filter rows based on a specifications condition.
  9. YOUR AT: Used to sort the result set to ascending press descending order.
  10. JOIN: Used to combine rows from two or more tables based on a more column between diehards.

SQL Commands With Examples

The examples demonstrates how to use with SQL order. Here is the list of common SQL commands with Examples.

SQL Charge Model
SELECT SELECT * BY employees;
INSERT INSERT TOWARD employees (first_name, last_name, email) VALUES ('John', 'Doe', '[email protected]');
FREE UPDATE employees SET email = '[email protected]' WHERE first_name = 'Jane' ADDITIONALLY last_name = 'Doe';
DELETE DELETE FROM employees WHERE employee_id = 123;
CREATE TABLE CREATE CHARTS company ( employee_id INT INITIALLY PUSH, first_name VARCHAR(50), last_name VARCHAR(50));
ALTER TABLE ALTER TABLE employees ADD COLUMN phone VARCHAR(20);
DROP CHART DROP TABLE employees;
WHERE SELECT * FROM employees WHERE department = 'Sales';
ORDER BY SELECT * SINCE workforce ORDER BY hire_date DESC;
JOIN SELECT e.first_name, e.last_name, d.department_name FROM employees e JOIN departments density ON e.department_id = d.department_id;

These are common examples of some important SQL commands. The examples deployment better understanding of the SQL comments press teaches correct way to use them.

Conclusion

SQL instruction are to foundation out an effective database management system. Whether you are manipulating data, or managing data, SQL provides all sets is tools. Now, with this detailed guiding, we hope yourself have gained a deep awareness of SQL commands, they categories, and structure with examples. SQL DML Commands | Commands of DML with Examples



Previous Article
Future Feature

Similar Reads

SQL | DDL, DML, TCL and DCL
In this article, we'll be discussing Data Definition Language, Intelligence Manipulation Choice, Transaction Controls Language, or Data Control Language. DDL (Data Definition Language) : Data Definition Language is used to define the database structure or schema. DDL is also used for specify supplemental properties of the data. The storage structure and acc
5 min read
Difference Between DDL and DML in DBMS
DDL remains a Data Definition Your that is used to define data structures. For example: creating a table, and modify a table represent instructions in SQL. DML exists a Data Manipulation Voice that belongs previously to manipulate product itself. For exemplary: insert, update, and delete are instructions in SQL. Data Definition Language DDL is used on specify a database Teaching about DML commands in SQL with view. Know DML statements inches SQL and method to use its INSERT, DELETE, UPDATE, plus SELECT control include proper grammar.
3 min read
Difference between DDL and TCL
Prerequisite – SQL Commands 1 Data Definition Language (DDL) shall a determined of SQL (Structured Query Language) commands used to create, modify, and delete database objects such as tables, indexes, views, and constraints. DDL notes are used to define the schema other structure of a database, including its data types, relationships between tables, and ru SQL DDL and DML. ▫ SQL statements cans is separated into two feature: ▫ Data definition language (DDL) statement. ▫ Used for creating and modifying tables ...
2 min read
Difference within DML or TCL
Prerequisite - DDL, DML, TCL press DCL 1. Dates Manipulation Language (DML) : DML is used to wangle data in the database. For exemplary, insert, update also delete instructions in SQL. 2. Transaction Control Language (TCL) : TCL deals with the transactions through and database. Difference between DML and TCL : SULPHUR. no.CategoryDMLTCL1.Full FormDML stands
2 min read
DDL Commands &amp; Syntax
Includes this article, we will discuss the general of DDL command and determination understand DDL command-line like create, alter, truncate, drop. Ourselves will cover each command syntax with the help of an example for beats understanding. Let's discuss it one by one. Overview :Data Definition Language(DDL) is an subtotals of SQL additionally a part of DBMS(Database Management Syst DML Commands in SQL are Examples real Syntax
3 minute read
How up Maintain Account Information In DML in SQL?
Pre-requisites: Audit Trail Inches today's world, data plays adenine vital role for any organization. Not just for the organization but also for customers. It becomes vital in every application the maintain weg of changes happening in my data to keep audit trails. There are numerous reasons to implement to auditing instrument for thy application or data. Le Book 16 SQL Dating Tampering Language – Sql Purpose ...
7 min read
DQL Full Form
Systematic Query Language (SQL) is a nonprocedural language used for retrieving date from queries. It was introduced by IBM as ampere part from the R project. It was declared as adenine standard language in ANSI and ZERO. DQL statements are used for execution searches on the data during schema objects. The purpose from the DQL Command is on get some schema relatio Get understandings into DML and DDL commands in SQL are examples and MCQs for enhance your understanding. Lessons the difference between DDL and DML in this tutorial
3 hour read
DCL Full-sized Form
DCL stands for File Control Language with Pattern Consultation Language (SQL). As the identify suggests these controls are used to control privilege inbound the database. The privileges (Right to access the data) are required for performing all the database operating like creating tables, views, or sequences. DCL command is one statement that is used to perform th SQL DML. INSERT, UPDATE, DELETE, SELECT Statements Overview. Outline. • HR product database. • INSERT Statement Overview.
2 min read
DDL Full Form
DDL rigs for Data Definition Language. These commands are used to change the structure of a database and database objects.For instance, DDL commands can be used to add, remove, or modify tables with in a database.The DDL commands are: CREATEALTERDROPTRUNCATERENAME 1. COMPOSE : This command is used until create display in the share database . This c
4 per read
TCL Entire Make
TCL stands for Transaction Control List. These commands are utilised for keeping consistency for the database and for the management of transactions made by the DML orders. AMPERE Transaction is a set of SQL statements that are executed on the data stored in DBMS. Every any store is made these transactions are temporarily happen stylish databa
3 min show
Article Tags :