当前位置:网站首页>Oracle database knowledge points that cannot be learned (III)
Oracle database knowledge points that cannot be learned (III)
2022-07-04 00:41:00 【zhulin1028】
Catalog
Locks and database objects
1. lock
The mechanism used by database to control concurrent access to shared resources .
The type of lock : Row-level locks , Table lock .
Row-level locks : Lock the row being modified . Row lock is also called exclusive lock .
When using the following statements ,Oracle Will automatically apply row level lock :
insert,update,delete,select…… for update
select……for update Allow users to lock multiple records for update at a time .
Use commit or rollback Release the lock .
Table lock :
lock table user_tbl in mode mode;
Table lock type :
Line sharing row share
OK, exclusive row exclusive
share share
Shared row exclusive share row exclusive
Exclusive exclusive
Deadlock : Two or more transactions wait for each other to release resources , So it's a deadlock
2. Database objects
oracle Database objects are also called schema objects
Database objects are collections of logical structures , The most basic database objects are tables
Database objects :
surface , Sequence , View , Indexes .
Sequences are used to generate unique , Objects with consecutive numbers .
Create Syntax :
create sequence user_id_seq
start with 1000
increment by 1
maxvalue 2000
minvalue 1000
nocycle
cache 1000;-- Specify the sequence number preallocated in memory
Access sequence :
select user_id_seq.currval from dual;
select user_id-seq.nextval from dual;
Change delete sequence :
alter sequence user_id_seq maxvalue 10000;-- It cannot be modified start with value
drop sequence user_id_seq;
stay Hibernate Medium access sequence :
<generator class="sequence">
<param name="sequence">
user_id_seq
</param>
</generator>
View
Display data from one or more tables in a customized way
Create view :
create or replace view
user_tbl_view (vid,vname,vage)
as select id,user_name,age from user_tbl
[with check option]|[with read only];
Create a view with errors :
create force view user_tbl_force_view as
select * from user_table;-- here user_table Can not exist
Create an outer join view :
create view user_stu_view as
select u.id,u.user_name,u.password,s.ddress
from user_tbl u,stu_tbl s
where u.s_id(+)=s.id;-- Which side has (+), Which side is secondary
Delete view :
drop user_stu_view;
The index is used to improve SQL The performance of statement execution
Index type :
unique index , Bitmap index , Composite index , Function based index , Reverse key index
Create a standard index :
create index user_id_index on user_tbl(id) tablespace schooltbs;
Rebuild index :
alter index user_id_index rebuild;
Delete index :
drop index user_id_index;
Create unique index :
create unique index user_id_index on user_tbl(id);
Create a composite index :
create index name_pass_index on user_tbl(user_name,password);
Create reverse key index :
create index user_id_index on user_tbl(id) reverse;
边栏推荐
- CesiumJS 2022^ 源码解读[8] - 资源封装与多线程
- NLP Chinese corpus project: large scale Chinese natural language processing corpus
- 打印菱形图案
- [complimentary ppt] kubemeet Chengdu review: make the delivery and management of cloud native applications easier!
- On the day when 28K joined Huawei testing post, I cried: everything I have done in these five months is worth it
- Similarities and differences of text similarity between Jaccard and cosine
- From functional testing to automated testing, how did I successfully transform my salary to 15K +?
- Several ways to set up a blog locally [attach relevant software download links]
- Employees' turnover intention is under the control of the company. After the dispute, the monitoring system developer quietly removed the relevant services
- STM32 GPIO CSDN creative punch in
猜你喜欢
Release and visualization of related data
Future source code view -juc series
Recommendation of knowledge base management system
MySQL is installed as a Windows Service
Detailed explanation of the relationship between Zhongtai, wechat and DDD
What is the potential of pocket network, which is favored by well-known investors?
Regular expressions and text processors for shell programming
URL (data:image/png; Base64, ivborw0k... Use case
[common error] custom IP instantiation error
Several ways to set up a blog locally [attach relevant software download links]
随机推荐
不得不会的Oracle数据库知识点(四)
URL (data:image/png; Base64, ivborw0k... Use case
Swagger2 quick start and use
Stock price forecast
Arc 135 supplementary report
功能:编写函数fun求s=1^k+2^k +3^k + ......+N^k的值, (1的K次方到N的K次方的累加和)。
ESP Arduino playing with peripherals (V) basic concept of interrupt and timer interrupt
[NLP] text classification still stays at Bert? Duality is too strong than learning framework
The culprit of unrestrained consumption -- Summary
[common error] UART cannot receive data error
Design of database table foreign key
On covariance of array and wildcard of generic type
What is the GPM scheduler for go?
Global and Chinese markets of distributed control system (DCS) consumption 2022-2028: Research Report on technology, participants, trends, market size and share
[prefix and notes] prefix and introduction and use
2-redis architecture design to use scenarios - four deployment and operation modes (Part 2)
MySQL winter vacation self-study 2022 12 (2)
How to trade spot gold safely?
Release and visualization of related data
Global and Chinese market of process beer equipment 2022-2028: Research Report on technology, participants, trends, market size and share