当前位置:网站首页>Oracle data integrity
Oracle data integrity
2022-07-01 00:47:00 【Mr. Li, a prodigy】
If a worker wants to do a good job, he must sharpen his tools first
Articles are constantly updated , You can search by wechat 【 Xiaoqi JAVA interview 】 First time reading , reply 【 Information 】 Access to benefits , reply 【 project 】 Get the source code of the project , reply 【 The resume template 】 Get resume template , reply 【 Learning Roadmap 】 Get a learning roadmap .

List of articles
One 、 Non empty constraint
not null
1、 Create a student table , There are two fields , The first field is id yes number type , The second field is name yes varchar2 Type and cannot be empty .
create table student(
id number,
name varchar2 not null,
)
Two 、 Unique constraint
unique
1、 Create a student table , There are two fields , The first field is id yes number type , The second field is name yes varchar2 Type and no repetition is allowed .
Copying tables is actually used to back up tables
create table student(
id number,
name varchar2 unique,
)
3、 ... and 、 Primary key constraint
1、 Create a student table , There are two fields , The first field is id yes number Type and primary key , The second field is name yes varchar2 Type and cannot be empty .
create table student(
id number,
name varchar2 not null,
constraint pk_id primary key(id);
Four 、 Composite primary key constraint
1、 Create a student table , There are two fields , The first field is id yes number type , The second field is name yes varchar2 type , And set the two fields as a composite primary key constraint .
create table student(
id number,
name varchar2,
constraint pk_id primary key(id,name);
5、 ... and 、 Check constraint
1、 Create a student table , There are two fields , The first field is id yes number Type and primary key , The second field is name yes varchar2 type , The third is age yes number type , also age stay 0-100 Between .
create table student(
id number,
name varchar2,
age number,
constraint pk_id primary key(id),
constraint ck_age check(age between 0 and 100);
6、 ... and 、 Foreign key constraints
1、 Create a student table , There is a field , The first field is id yes number Type and primary key , Create a teacher table , There are two fields , The first field is id yes number type , The second field is sid And for students id The foreign key
create table student(
id number,
constraint pk_id primary key(id);
create table teacher(
id number,
sid number
constraint fk_sid foreign key(sid) references student(id);
7、 ... and 、 Modify constraints
1、 Put the student list student Add primary key id Constraints
alter table student add constraint pk_id primary key(id);
2、 Put the student list student Of name Change the field to non empty constraint
alter table student modify(name varchar2 not null);
8、 ... and 、 summary
The relevant contents here have not been sorted out yet , The article continues to be updated later , Recommended collection .
The commands involved in the article must be typed several times each like me , Only in the process of knocking can you find out whether you really master the command .
You can search by wechat 【 Xiaoqi JAVA interview 】 First time reading , reply 【 Information 】 Access to benefits , reply 【 project 】 Get the source code of the project , reply 【 The resume template 】 Get resume template , reply 【 Learning Roadmap 】 Get a learning roadmap .
边栏推荐
- Deployment of mini version message queue based on redis6.0
- Which is better, server rental or hosting services in the United States?
- Oracle临时表详解
- 获取屏幕高度
- Examples of topological sequences
- 2022-2028 global ultra high purity electrolytic iron sheet industry research and trend analysis report
- P4 learning - p4runtime
- P4学习——Basic Tunneling
- Integer to hexadecimal string PTA
- Get screen height
猜你喜欢

Random ball size, random motion collision

Unit test concept and purpose

优质的水泵 SolidWorks模型素材推荐,不容错过

C language file operation for conquering C language

Introduction to ES6 promise, new features of ES7 and es8 async and await

20220215 misc buctf easycap Wireshark tracks TCP flow hidden key (use of WinHex tool)

C # Generate PPK files in Putty format (passthrough support)

Line number of Jenkins pipeline script execution exception

Wechat official account development (1) introduction to wechat official account

Error 2059 when Navicat connects to MySQL
随机推荐
Authentication principle of Ranger plug-in
运动与健康
Quick start of wechat applet -- project introduction
leetcode 474. Ones and Zeroes 一和零(中等)
Date类的实现
P4 learning - Basic tunneling
Rust controls Dajiang programmable UAV Tello
Sword finger offer 19 Regular Expression Matching
[2023 MediaTek approved the test questions in advance] ~ questions and reference answers
Self examination before school starts
Sword finger offer 18 Delete the node of the linked list
Oracle-数据完整性
Introduction to ES6 promise, new features of ES7 and es8 async and await
P4 learning - p4runtime
Redis - how to understand publishing and subscribing
What is product thinking
ArrayList analysis 1-cycle, capacity expansion, version
Simple application example of rhai script engine
C # Generate PPK files in Putty format (passthrough support)
C WinForm program interface optimization example