MYSQL/RDBMS Concepts
An introduction to TCL Statements
An Introduction to DML statements
An Introduction to DQL
DML stands for Data Manipulation Language. Using DML commands in SQL, we can make changes in the data present in tables.
DML commands in SQL will change the data, such as inserting new records, deleting or updating existing records from the SQL tables. We can also retrieve all the data from SQL tables according to our requirements.
Commands covered under DML are:
INSERT
SELECT
UPDATE
DELETE
Data Manipulation Language (DML)
INSERT command is used to insert records in a table. We can insert a single as well as multiple records for a single table at the same time.
Syntax:
INSERT INTO table_name VALUES (column_1 value,column_1value);
Data Manipulation Language (DML)
A SELECT command is used to retrieve the records from the table. According to our requirements, we can retrieve all the records or some specific records from the table.
Syntax to retrieve all the records:
SELECT *FROM table_name;
Syntax to retrieve some specific records:
SELECT *FROM table_name WHERE condition;
Data Manipulation Language (DML)
UPDATE command works for the values present in the table.Whenever we wish to update a value for any record present in a table, we will use the UPDATE command in SQL.
Syntax:
UPDATE table_name SET column_name = value
WHERE condition;
Data Manipulation Language (DML)
DELETE command is used to remove records from a table.
Syntax:
DELETE FROM table_name;
DCL stands for Data Control Language.
Whenever we want to control the access to the data present in SQL tables, we will use DCL commands in SQL. Only the authorized users can access the data stored in the tables.
There are two types of DCL Commands:
1. GRANT
Access privileges can be assigned to a user for the databases and tables using the GRANT command.
2. REVOKE
All the access privileges which are already assigned to the user can be revoked by using the REVOKE command.
TCL stands for Transaction Control Language. TCL commands are generally used in transactions.
Using TCL commands in SQL, we can save our transactions to the database and roll them back to a specific point in our transaction. We can also save a particular portion of our transaction using the SAVEPOINT command.
Some TCL Commands include:
1. COMMIT:
To save all the operations executed in a particular transaction, we need to execute a commit command just after the transaction completion.
2. ROLLBACK
Using the rollback command in SQL, you can roll to the last saved state of a transaction.
3. SAVEPOINT
Using the SAVEPOINT command, you can assign a name to a specific part of the transaction.
Advantages
1.No programming needed
2. High-Speed Query Processing
3. Standardized Language
4. Portability
5. Interactive language
6. More than one Data View