Home >Database >Mysql Tutorial >What are the different commands used in MySQL?

What are the different commands used in MySQL?

王林
王林forward
2023-09-07 19:53:021087browse

MySQL 中使用哪些不同的命令?

SQL language is divided into four main language statements: DML, DDL, DCL and TCL. Using these statements, we can define the structure of the database by creating and changing database objects, and we can manipulate the data in the tables by updating or deleting. We can also control which users can read/write data or manage transactions to create a single unit of work.

The four main categories of SQL statements are as follows -

DML (Data Manipulation Language)

DML statements affect records in a table. These are the basic operations we perform on data such as selecting some records from a table, inserting new records, deleting unnecessary records, and updating/modifying existing records.

DML statements include the following-

SELECT – Select records from table

  • INSERT – Insert new records
  • UPDATE – Update/Modify Existing records
  • DELETE – Delete existing records

DDL (Data Definition Language)

DDL statements are used to change/modify the database or table structure and schema. These statements deal with the design and storage of database objects.

  • CREATE – Create new tables, databases, schemas
  • ALTER – Change existing tables, column descriptions
  • DROP – Delete existing objects from the database

DCL (Data Control Language)

DCL statements control a user's access level to database objects.

  • GRANT – Allows users to read/write certain database objects
  • REVOKE – Blocks users from reading/writing permissions on database objects

TCL ( Transaction Control Language)

TCL statements allow you to control and manage transactions to maintain data integrity within SQL statements.

  • BEGIN Transaction – Open transaction
  • COMMIT Transaction – Commit transaction
  • ROLLBACK Transaction – Any error occurred in ROLLBACK transaction

The above is the detailed content of What are the different commands used in MySQL?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:tutorialspoint.com. If there is any infringement, please contact admin@php.cn delete