A) TCL
B) SCL
C) DCL
D) DDL
The accurate answer is option B: SCL (Structured Command Language) is not an acknowledged SQL command. The recognized SQL commands consist of DDL, DML, DCL, and TCL.
Table of Contents:
- Valid Categories of SQL Commands
- Conclusion
Valid Categories of SQL Commands
1. TCL – Transaction Control Language
TCL is utilized to oversee transactions in a database. This command guarantees that a series of processes executed as a single unit are successful. The commands used in this language include COMMIT, ROLLBACK, and SAVEPOINT.
COMMIT Query
COMMIT: To preserve all alterations made during the ongoing transaction.
Syntax for COMMIT
COMMIT;
ROLLBACK Query
ROLLBACK: To reverse all changes made during the current transaction.
Syntax for ROLLBACK
ROLLBACK;
SAVEPOINT Query
SAVEPOINT: To establish a savepoint within a transaction, permitting partial rollback.
Syntax for SAVEPOINT
SAVEPOINT savepoint_name;
DDL – Data Definition Language
DDL commands are utilized to define and manage the configuration of database objects. This command is employed to create, modify, and eliminate database objects such as tables, indices, and schemas. The commands encompass:
CREATE Query
CREATE: To generate new database objects like tables or indices.
Syntax for CREATE
CREATE TABLE table_name (
column1 datatype constraints,
column2 datatype constraints,
column3 datatype constraints,
...
);
ALTER Query
ALTER: To change the existing database object.
Syntax for ALTER
ALTER TABLE table_name
ADD column_name datatype constraints;
DROP Query
DROP: To erase existing database objects.
Syntax for DROP
DROP TABLE table_name;
TRUNCATE Query
TRUNCATE: To eliminate all records from the table while retaining the table structure.
Syntax for TRUNCATE
TRUNCATE TABLE table_name;
DML – Data Manipulation Language
DML commands serve to manipulate and manage the data within the database. These commands enable users to retrieve, insert, update, and delete data. The commands include:
RETRIEVE Query
RETRIEVE: The SELECT command is employed to fetch data from the database.
Syntax for RETRIEVE
SELECT column1, column2, ...
FROM table_name
WHERE condition;
INSERT Query
INSERT: To append a new record to the table.
Syntax for INSERT
INSERT INTO table_name (column1, column2, column3, ...)
VALUES (value1, value2, value3, ...);
UPDATE Query
UPDATE: To alter existing data in the table.
Syntax for UPDATE
UPDATE table_name
SET column1 = value1, column2 = value2, ...
WHERE condition;
DELETE Query
DELETE: To eliminate the records from the table.
Syntax for DELETE
DELETE FROM table_name
WHERE condition;
DCL – Data Control Language
DCL commands are utilized to govern access to data within the database. This command manages permissions and access control. The commands include GRANT and REVOKE.
GRANT Query
GRANT: To assign specific privileges to the user.
Syntax for GRANT
GRANT privilege_type ON object_name
TO role_name
[WITH GRANT OPTION];
REVOKE Query
REVOKE: To withdraw specific user privileges. DCL commands assist in maintaining the database’s security by regulating access.
Syntax for REVOKE
REVOKE privilege_type ON object_name
FROM role_name;
Conclusion
SCL (Structured Command Language) is not acknowledged as an SQL command. The standard SQL commands comprise DDL (Data Definition Language), DML (Data Manipulation Language), DCL (Data Control Language), and TCL (Transaction Control Language). Each has an essential role in administering and manipulating data within a database. For those interested in expanding their knowledge on these key concepts, consider exploring our industry-focused SQL Course.
The article What is not a category of SQL command first appeared on Intellipaat Blog.