SQL language Classification SQL language is divided into four categories: Data Query Language DQL, Data manipulation language DML, data definition language DDL, Data Control Language DCL. &NBSP;1: Data Query Language DQL Q = query data querying language DQL used to retrieve a database The basic structure is a query block consisting of a SELECT clause, a FROM clause, a WHERE clause: Select < field name Table >from < table or view name >where < query conditions > 2: Data manipulation language DML M = manipulation Data Manipulation language DML is used to change database data mainly in three ways: 1) Insert: INSERT2) Update: UPDATE3) Delete: delete 3: Transaction Control language TCL C = control transaction controlling language TCL used to maintain data consistency contains three statements: 1) commit;2) rollback;3) savepoint; 4: Data definition language DDL D = definition Data Definitions Language DDL is used to create, modify, delete various objects in the database-----tables, views, indexes, synonyms, clusters, etc.: CREATE table/view/index/syn/cluster| | | | | Table View index synonym cluster &NBSP;5: Data Control Language DCL (auto-Commit TRANSACTION) Data Control Language DCL is used to grant or reclaim some kind of privilege to access the database, and to control the time and effect of database manipulation transactions, to monitor the database and so on. Contains two commands: 1) Grant: authorization. 2) REVOKE: withdrawn. 1) ROLLBACK [work] to [savepoint]: fallback to a point. Rollback---rollback rollback command to bring the database state back to the last committed state. The format is: sql>rollback;2) commit [work]: Submit. When inserting, deleting, and modifying a database, the transaction is completed only when it is committed to the database. Before a transaction is committed, only the person who operates the database has permission to see what is being done, and others can only see it after the final commit is completed. There are three types of submission data: Explicit commit, implicit commit, and auto-commit. These three types are described below. (1) An explicit commit is explicitly submitted with a commit command that is completed directly. The format for:sql>commit; (2) implicitly commits an implicit commit with a SQL command that is done indirectly. These commands are: Alter,audit,comment,connect,create,disconnEct,drop,exit,grant,noaudit,quit,revoke,rename. (3) Auto-commit if the autocommit is set to ON, the system will commit automatically when the insert, modify, DELETE statement is executed. The format is: Sql>set autocommit on;
Day09 (SQL Foundation)