view
- View is a virtual table used to isolate the database
- Create a view
- Creating a view is not allowed to have the same field name
- create view view name as select statement;
- Modify View
- alter view view name as select statement;
- Delete View
- drop view view name
- A view is not easy to modify the query
- View of the role
- Improved reusability, as a function
- When the reconstruction of the database, does not affect the use of data
- Improved security, allowing different users
- Make the data more clearly
Affairs
- What is a transaction
- It is a sequence of operations, these operations are either executed, or not executed, it is indivisible unit of work
- Four characteristics of the transaction (referred to as ACID)
- Atomicity
- consistency
- Either all succeed or fail
- Isolation
- Before submitting a transaction, other things can not see, use a database row-level locking
- Endurance
Open transaction start transaction; or begin;
start transaction; -- sql语句,必须所有的语句都执行完毕,不然就会回滚数据 commit;
- mysql client is enabled by default affairs, and is the default commit the transaction
- Python is also enabled by default affairs, but requires manual submission
- After the data is not submitted data rollback
index
- Index is a special file (the index table innodb data table is an integral part of the space), which contains pointers to all records of the reference data table
- A special data structure
- Direct reference database stored (pointer)
- Speed up database query
- Open running time detection
- set profiling=1;
- View time
- show profiles;
- Creating an index
- create index index name on table name (field name (length))
- Delete Index
- drop index index name on table
- The establishment of too many index will affect the speed of updates and inserts
Account Management
- Need to use mysql database
- Check the user name account password
- select host, user, authentication_string from user;
- Create an account and authorize
- grant select on jing_dong.* to 'langwang'@'localhost' identified by '123456';