In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
=====
Virtual tables in the database, equivalent to soft links
Role: Data in a table provides access to users with different permissions
Consider a table:
Employee Performance Salary Assessment Form
Job ID Name Age Post Performance Salary
1 Tom 50 President 1 million
2 Jerry 42 Director 90 200,000
3 charry 30 Cloud computing engineers 80 120,000
4 Jack 24 Cloud Computing Engineer 90 150,000
Syntax: create view name as (optional) select statement
Create a form view to find tables with grades greater than 80
create view score_view as select * from info where score >80;
Modifying a view also means modifying a table
update score_view set score=88 where name='lisi';
====
A database transaction is a series of operations performed as a single logical unit of work, either completely or not at all. Transaction processing ensures that data-oriented resources are not permanently updated unless all operations within a transactional unit complete successfully. By grouping a set of related operations into a single unit that either succeeds or fails, you simplify error recovery and make your application more reliable.
For a logical unit of work to be a transaction, it must satisfy properties called ACID (atomicity, consistency, isolation, and persistence). Transaction is the logical unit of work in database operation, and the transaction management subsystem in DBMS is responsible for transaction processing.
A set of operations performed together or at all, with consistent results.
Assumption Example: Bank Transfer
Name Balance [Condition: Balance must be greater than 0]
zhangsan 100
lisi 200
Assumption operation: zhangsan transfer 100 to lisi (operation is not established)
Execution process statement of bank database transfer:
begin #begin
update bank set money=money-100 where name='zhangsan'
update bank set money=money+100 where name='lisi'
rollback #rollback
commit #submit
#Because zhangsan's account balance cannot be equal to 0, the statement does not hold true, directly execute rollback #rollback.
Principle: as long as there is a statement can not be successfully executed on the rollback
Either execute, maintain consistency of results,
Either roll back to the beginning of begin (the operation performed in memory), and do not execute
Set command:
set autocommit=0 #Disable autocommit is equivalent to begin
set autocommit=1 #Enable autocommit
In the begin transaction operation
savepoints1; #equivalent to snapshot, save current mysql operation
rollback to savepoint s1; #rollback to previous savepoint
commit; #Once committed, it cannot be changed
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.