当前位置:网站首页>Oracle create table, delete table, modify table (add field, modify field, delete field) statement summary
Oracle create table, delete table, modify table (add field, modify field, delete field) statement summary
2022-07-28 05:41:00 【CTRL Trainee - brother Xie blog】
Create table :
create table Table name (
Field name 1 Field type The default value is Is it empty ,
Field name 2 Field type The default value is Is it empty ,
Field name 3 Field type The default value is Is it empty ,
…
);
Create a user surface :
create table user (
id number(6) primary key, — Primary key
name varchar(50) not null, — full name Not for null
sex varchar2(6) default ‘ male ’ check ( sex in (‘ male ’,‘ Woman ’)) — Gender Default ’ male ’
);
Modify the name of the table :
rename The old name of the table to The new name of the table ;
rename user to newuser;
Delete table :
delete from Table name ;
delete Deleting data is deleting data one by one , You can add where Conditions , Do not delete table structure . Be careful : If there is identity The resulting self accretion id Column ,delete from After that, it still increased from the last number .
truncate table Table name ;
truncate Delete all data at once , Do not delete table structure . Be careful : If there is identity The resulting self accretion id Column ,truncate after , Will restore the initial value .
drop table Table name ;
drop Delete all data , The table structure will be deleted .
Modify table :
Add new fields :
alter table Table name add( Field name Field type The default value is Is it empty );
alter table user add(age number(6) null);
alter table user add (course varchar2(30) default ‘ empty ’ not null);
alter table user add create_date date null;
Add a comment to the field :comment on column table.create_date is ‘ Date of creation ’;
Modify fields :
alter table Table name modify ( Field name Field type The default value is Is it empty );
alter table user modify(age number(8));
Modify field name :
alter table Table name rename column Name to New column names ;
alter table user rename column course to newcourse;
Delete field :
alter table Table name drop column Field name ;
alter table user drop column course;
边栏推荐
- openjudge:字符串最大跨距
- RESNET structure comparison
- Distillation model diagram
- ByteBuffer. Position throws exception illegalargumentexception
- Openjudge: count the number of numeric characters
- ResNet结构对比
- [idea plug-in artifact] teaches you how to set all attributes in an entity class with one click of idea
- 冶金物理化学复习 --- 金属的电沉积,还原过程
- Framework step by step easy-to-use process
- Methods of gflops and total params of pytorch calculation model
猜你喜欢

Operation and use of collection framework

Review of metallurgical physical chemistry --- liquid liquid reaction kinetics

repackag failed: Unable to find main class

repackag failed: Unable to find main class

Long和Integer如何进行比较,为什么报错

冶金物理化学复习 -- 金属电沉积过程中的阴极极化,超电势以及阳极和阳极过程

Redis 之布隆过滤器

latex和word之间相互转换

GET与POST区别

Review of Metallurgical Physical Chemistry - gas liquid phase reaction kinetics
随机推荐
List<Long>,List<Integer>互相转换
LocalDateTime去掉T,JSONField失效
openjudge:大小写字母互换
冶金物理化学复习 -- 金属电沉积过程中的阴极极化,超电势以及阳极和阳极过程
PyTorch 使用 MaxPool 实现图像的膨胀和腐蚀
Video twins: the starting point of informatization upgrading of smart Parks
论文写作用词
JVM篇 笔记4:内存模型
Idea uses dev tool to realize hot deployment
2021CSDN博客之星评选,互投
Pytorch uses maxpool to realize image expansion and corrosion
lamda 获取当前循环数,AtomicInteger
(黑马)MYSQL初级-高级笔记(博主懒狗)
URL 形式
Openjudge: upper and lower case letters are interchanged
pytorch使用hook获得特征图
openjudge:校园食宿预订系统
CentOS7安装MySQL5.7
[MySQL] solve the problem of MySQL time zone and 8-hour difference in database time
动态卷积的本质