Data definition Language: language, referred to as DDL, including Createdrop alter statements Create table/database table name/database name; drop table name; (Both records and structure are deleted) Alter table name Add column adds a new list name type; ALTER TABLE name modify column name type; (Modify the properties of the column in the table) Alter Table name change column (can omit) old column name new name type;
Data manipulation language: manipulation language, referred to as DML, which includes insertupdate DELETE statements Insert into table name (column name, column name, ...) Values (value 1, value 2, ...) ); Update table Name set column name = new value, column name = new value where column name = value; Delete from table name where column name = value; (Delete records only, do not delete structure)
Query Language: Data Retrieval language, abbreviated DRL, which includes a SELECT statement Dual is a virtual table that can be used to calculate, for example: select 1+3 ' sum ' from Dual;
Transaction Control Language: Transaction Control Language, abbreviated as TCL, which includes commit,rollback and other statements.
Definition of a transaction: a multi-step operation on a database, each step is equivalent to a transaction
The default commit of a transaction is automatically committed, which is autocommit=true
Transaction savepoint: SavePoint Prerequisite: You must set manual commit, or set autocommit=false. Update teacher_tab set gender= ' m ' whereid=2; Delete from Teacher_tab where id=8; SavePoint P1;
Delete from Teacher_tab where id=7;
At this time if the id=7 record is considered to be a false deletion, if you want to recover, you can use rollback to rollback, that is, rollback to P1, the record is restored. If you use rollback directly, all previous operations are restored.
|