A) TCL
B) SCL
C) DCL
D) DDL
The correct answer is option B: SCL(Structured Command Language) is not a recognized SQL command. The standard SQL commands are DDL, DML, DCL, and TCL.
Table of Contents:
Valid Categories of SQL Commands
1. TCL-Transaction Control language
TCL is used to manage the transactions within a database. This command ensures that a series of operations executed as a single unit work. COMMIT, ROLLBACK and SAVEPOINT are the commands used in this language.
COMMIT Query
COMMIT: To save all changes made during the current transaction.
Syntax for COMMIT
COMMIT;
ROLLBACK Query
ROLLBACK: To undo all changes made during the current transaction.
Syntax for ROLLBACK
ROLLBACK;
SAVEPOINT Query
SAVEPOINT: To set a savepoint within a transaction, allowing partial rollback.
Syntax for SAVEPOINT
SAVEPOINT savepoint_name;
DDL- Data Definition Language
DDL command is used to define and manage the structure of database objects. This command is used to create, alter, and drop database objects like tables, indexes, and schemas. The command includes:
CREATE Query
CREATE: To create new database objects like tables or indexes.
Syntax for CREATE
CREATE TABLE table_name (
column1 datatype constraints,
column2 datatype constraints,
column3 datatype constraints,
...
);
ALTER Query
ALTER: To modify the existing database object.
Syntax for ALTER
ALTER TABLE table_name
ADD column_name datatype constraints;
DROP Query
DROP: To delete existing database objects.
Syntax for DROP
DROP TABLE table_name;
TRUNCATE Query
TRUNCATE: TO remove all the records from the table, but keep the table structure.
Syntax for TRUNCATE
TRUNCATE TABLE table_name;
DML- Data Manipulation object
DML commands are used to manipulate and manage the data inside the database. These commands allow users to retrieve, insert, update, and delete data. The command includes:
RETRIEVE Query
RETRIEVE: The SELECT command is used to retrieve data from the database.
Syntax for INSERT
SELECT column1, column2, ...
FROM table_name
WHERE condition;
INSERT Query
INSERT: To add a new record to the table.
Syntax for INSERT
INSERT INTO table_name (column1, column2, column3, ...)
VALUES (value1, value2, value3, ...);
UPDATE Query
UPDATE: To modify existing data in the table.
Syntax for UPDATE
UPDATE table_name
SET column1 = value1, column2 = value2, ...
WHERE condition;
DELETE Query
DELETE: To remove the records from the table.
Syntax for DELETE
DELETE FROM table_name
WHERE condition;
DCL – Data Control Language
DCL command is used to access the data within the database. This command manages the permission and access control. Commands include GRANT and REVOKE.
GRANT Query
GRANT: To give the user specific privileges.
Syntax for GRANT
GRANT privilege_type ON object_name
TO {user_name | role_name}
[WITH GRANT OPTION];
REVOKE Query
REVOKE: To remove the specific user privileges. DCL command helps to maintain the security of the database by controlling access.
Syntax for REVOKE
REVOKE privilege_type ON object_name
FROM {user_name | role_name};
Conclusion
SCL(Structured Command Language) is not recognized as an SQL command. The standard SQL command includes DDL(Data Definition Language), DML(Data Manipulation Language), DCL(Data Control Language), and TCL(Transaction Control Language). Each plays a crucial role in managing and manipulating data within a database. If you want to learn more about these fundamental concepts, then you should check out our industry-based SQL Course.