alter table brand add constraint uq_name unique(name) alter table brand add (description varchar2(100) ) alter table product modify (product_name varchar2(100) ) alter table brand rename column name to brand_name alter table brand drop column description alter table brand rename to brand_mst
Category Archives: Oracle
Oracle foreign key constraint example
create table brand ( code char(5) not null, name varchar2(50), constraint pk_code primary key(code) ) create table product_group ( group_code number not null, group_name varchar2(50), brand_code char(5), constraint pk_group primary key(group_code), constraint fk_brand_code foreign key(brand_code) references brand(code) ) create table product ( product_code number, product_name varchar2(50), group_code number, constraint pk_product primary key(product_code), constraint fk_group_code foreign key(group_code) references product_group(group_code) )
Oracle table creation with constraints
create table customer ( id number, name varchar2(50) not null, type varchar(15) check (type in (‘Online’,’Retail’)), creditlimit number check (creditlimit > 10000), cellphone number(10), constraint pk_custid primary key(id), constraint uq_cellphone unique(cellphone) ); >Table created
Oracle table creation example
Table creation example create table Employee ( id number(4), name varchar2(50) ); Table created describe Employee Name Null? Type ——– ——- ——– ID NUMBER(4) Name VARCHAR2(50) insert into Employee values(100,’John’); 1 row createdContinue reading “Oracle table creation example”