当前位置:网站首页>Common modification commands of Oracle for tables
Common modification commands of Oracle for tables
2022-07-06 23:43:00 【Jaffy】
Sometimes when we do projects, we don't just touch a single database ,MySQL
Database or Oracle
database , Generally, you should learn more or less in the process of participation , Next, I will record a few of our Oracle
Several operation commands commonly used in database , In order to meet in the future , There is a place to find .
Add column fields of the table
alter table Table name add(
Field 1 data type ,
Field 2 data type
);
-- Example In the existing User Add an address field to the table `address`, The data type is varchar2, The length is 30
alter table user add(
address varchar2(30)
);
Modify the column fields of the table
alter table Table name modify( Field 1 data type ,.....)
-- Example , Modify existing User Address fields in the table `address`, The data type is varchar2, The length is 50
alter table user modify(address varchar2(50));
Remove the column fields of the table
alter table Table name drop column Field
-- Example , Delete existing tables User Address fields in the table `address`
alter table user drop column address
Set the comment for the field
COMMENT ON COLUMN " Table space "." Table name "." Field name " IS ' The comment ';
-- Example , Set the existing User Address fields in the table `address` The content of the note is ' Address '
COMMENT ON COLUMN "scott"."user"."address" IS ' Address ';
Paging templates
SELECT *
FROM (SELECT a.*, ROWNUM rn
FROM (
Business sql
) a
WHERE ROWNUM <= Final offset )
WHERE rn >= Starting offset
-- Example , Inquire about User The data table , Show the first page , each page 20 Data
SELECT *
FROM (SELECT a.*, ROWNUM rn
FROM (
select * from user
) a
WHERE ROWNUM <= 20)
WHERE rn >= 1
Create a sequence of tables
CREATE SEQUENCE " Table space "." The sequence of " MINVALUE 1 MAXVALUE 999999999999999999999999999 INCREMENT BY 1 START WITH 1 NOCACHE NOORDER NOCYCLE
-- Example , establish user Sequence of tables , Used to increment id
CREATE SEQUENCE "scott"."user_S" MINVALUE 1 MAXVALUE 999999999999999999999999999 INCREMENT BY 1 START WITH 1 NOCACHE NOORDER NOCYCLE
边栏推荐
- One minute to learn how to install the system, win7 XP, win10 and win11 become very simple
- 《数字经济全景白皮书》保险数字化篇 重磅发布
- 谁说新消费品牌大溃败?背后有人赢麻了
- Talking about the current malpractice and future development
- (LeetCode)两数之和
- 云原生(三十二) | Kubernetes篇之平台存储系统介绍
- Summary of three methods for MySQL to view table structure
- AI表现越差,获得奖金越高?纽约大学博士拿出百万重金,悬赏让大模型表现差劲的任务...
- 英国都在试行4天工作制了,为什么BAT还对996上瘾?
- The important data in the computer was accidentally deleted by mistake, which can be quickly retrieved by this method
猜你喜欢
(1)长安链学习笔记-启动长安链
今日睡眠质量记录78分
[unmanned aerial vehicle] multi unmanned cooperative task allocation program platform, including Matlab code
快手的新生意,还得靠辛巴吆喝?
MATLIB从excel表中读取数据并画出函数图像
After 3 years of testing bytecan software, I was ruthlessly dismissed in February, trying to wake up my brother who was paddling
Detailed explanation of regular expression (regexp) in MySQL
Basic chart interpretation of "Oriental selection" hot out of circle data
Gradle knowledge generalization
AI表现越差,获得奖金越高?纽约大学博士拿出百万重金,悬赏让大模型表现差劲的任务...
随机推荐
JS import excel & Export Excel
Koa2 addition, deletion, modification and query of JSON array
Today, I met a senior test developer from Tencent and saw the ceiling of the foundation
The important data in the computer was accidentally deleted by mistake, which can be quickly retrieved by this method
Daily question brushing record (XV)
Server SMP, NUMA, MPP system learning notes.
Oracle对表进行的常用修改命令
Laravel8 uses passport authentication to log in and generate a token
docker mysql5.7如何设置不区分大小写
Without CD, I'll teach you a trick to restore the factory settings of win10 system
A few suggestions for making rust library more beautiful! Have you learned?
Zero code and high return. How to use 40 sets of templates to meet 95% of the reporting needs in the work
每日刷题记录 (十五)
How to implement Lua entry of API gateway
[communication] optimal power allocation in the uplink of two-layer wireless femtocell network with matlab code
Wasserstein Slim GAIN with Gradient Penalty(WSGAIN-GP)介绍及代码实现——基于生成对抗网络的缺失数据填补
(LeetCode)两数之和
What does front-end processor mean? What is the main function? What is the difference with fortress machine?
AI表现越差,获得奖金越高?纽约大学博士拿出百万重金,悬赏让大模型表现差劲的任务...
(1) Chang'an chain learning notes - start Chang'an chain