Home > Back-end >  SqlYog transaction backup index of _ _ _ _ view recovery
SqlYog transaction backup index of _ _ _ _ view recovery

Time:10-03

TRANSACTION (TRANSACTION) must have the following four attributes, hereinafter referred to as ACID properties
1. The atomic (Atomicity)
Transaction is a complete operating and transaction of each step are inseparable (atomic), perform, or do not perform

2. The Consistency (Consistency)
When a transaction is completed, the data must be in a consistent state

3. The Isolation (Isolation)
Concurrent transactions between isolated, independent, it should not be dependent on or in any way affect the other transaction

4. Persistence (Durability)

After the completion of the transaction, it changes to the database permanently keep

create a transaction
1. Start the transaction the BEGIN. Or START the TRANSACTION;
2. To commit the transaction COMMIT;
3. The rollback (dropped) transaction the ROLLBACK.

automatically shut down and open transaction
1. The closed/open automatically submit status SET the autocommit=0 | 1; value is 0 when close the autocommit value is 1 to open automatically submit
SET the autocommit=0; - shut down automatically submit the following as a transaction
/* - transfer: zhang SAN's account to reduce 500 yuan, an increase of 500 yuan li si account - */
The UPDATE ` bank ` SET ` currentMoney `=` currentMoney ` - 500
WHERE ` customerName `='zhang';
The UPDATE ` bank ` SET ` currentMoney `=` currentMoney ` + 500
WHERE ` customerName `='bill';

COMMIT; - to commit the transaction
UPDATE ` bank ` SET ` currentMoney `=` currentMoney ` - 1000
WHERE ` customerName `='zhang';

the ROLLBACK. - - rollback transaction
SET the autocommit mode=1; - open automatically submitted to restore the default status


note: 1. Shut down automatically after submission, from the starting an SQL statement is opening a new transaction, need to use a COMMIT or ROLLBACK statement to end this transaction
2. By default, each single SQL statements as a transaction
3. After the default submission status, can be manually open and close the transaction


create a view
1. Use the SQL statement create the CREATE VIEW view_name (VIEW name custom) AS & lt; The SELECT statement & gt;;
2. Use the SQL statement delete DROP VIEW [IF EXISTS] view_name; note: including the if there is prior to delete the view is the exists
3. Use the SQL statement view SELECT fields, field 2,... The FROM view_name;

note: using the view of notice:
1. There will be many restrictions, use views to modify data in the actual development of
view is used only as a query
view can use multiple tables
2. Another view a view can be nested
3. To view the data to add, update, and delete operations directly affect the data in the table references
4. When the view data from multiple tables, are not allowed to add and delete data


index: data is an effective combination of ways, to quickly find the designated record
:
1. Greatly improve the database retrieval speed
2. To improve database performance

common index type
ordinary index [/color] allowed in defining index of insert duplicate values in a column and a null value
the only index (UNIQUE) index column data don't repeat [/color] allowed free value
the primary key index each value in the primary key column is empty, the only [/color] a primary key will automatically create the primary key index
will be more than one column combination as a index
full-text index (FULLTEXT) to support the value of the full text search [/color] allow duplicate values and null values
SPATIAL index of SPATIAL data type columns to establish index [/color]

index attributes:
Table: create an index Table
Non_unique: index is not the only
The name of the Key_name: index
Column_name: define the index column field
Seq_in_index: the column position in index
Null: the column can be Null
Index_type: index type


create/delete index
create index the CREATE [UNIQUE | FULLTEXT | SPATIAL index] INDEX index_name index (custom) ON table_name (table name) (column_name/length... (the column name (property)));

delete index DROP INDEX index_name index name (custom) ON table_name (table name);

view index SHOW INDEX the FROM table_name (table name);




  • Related