oracle table

create table product(
                  Product_id varchar2(10) not null,
                  Product_name varchar2(20),
                  ProductPrice number(8,2),
                  Quantity number(10),
                  Category varchar2(10),
                  Desperation varchar2(1000),
                  Origin varchar2(10)        
);

drop table product;

alter table product
 add remark varchar2(200);--增加列remark
 
 alter table product
       modify remark number(10,2);--修改列remark datatype
 
 select *from product
 
 alter table product drop column remark;--删除列remark
 
 
 
 
 alter table product add constraints pk_product primary key(Product_id);--主键是由一个列组成
 alter table product add constraints pk_product primary key(Product_id,product_name);--主键是由两个列组成
 
 
 
 create table categoryinfo(
        CategoryId varchar2(10),
        CategoryName varchar2(30),
        primary key(CategoryId)  
 );
drop table categoryinfo

alter table product
         Drop constraint pk_product
        
        
        
         create table productinfo1(
                  Product_id varchar2(10) not null,
                  Product_name varchar2(20),
                  ProductPrice number(8,2),
                  Quantity number(10),
                  Category varchar2(10),
                  Desperation varchar2(1000),
                  Origin varchar2(10),
                  primary key(Category),
                  constraint fk_pro foreign key(category)
                  references categoryinfo(CategoryId)
                          
        );
       
       
       
       
       alter table productinfo1
         add Constraint fk_pro foreign key(category)
         References categoryinfo(CategoryId); 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值