Sunday, 14 February 2016

Table Creation With Constraint : CUSTMER_MST

TABLE NAME : CUSTOMER_MST

create table customer_mst
(cust_no varchar2(6) primary key,
cust_name varchar2(15) not null,
address varchar2(20),
city varchar2(10),
constraint CHK_CUST_NO check (cust_no like 'ANA%' or cust_no like 'VVN%' or cust_no like 'BAK%'),
CONSTRAINT CHK_CITY check(city in ('ANAND','VVNAGAR','BAKROL')));

insert into customer_mst values('ANA001','ALAN','UNDI SHERI','ANAND');
insert into customer_mst values('VVN001','SMITH','NANA BAZAR','VVNAGAR');
insert into customer_mst values('ANA002','BLAKE','TOWN HALL ROAD','ANAND');
insert into customer_mst values('BAK001','ADAMS','VADTAL ROAD','BAKROL');
insert into customer_mst values('VVN002','WILLIAMS','MOTA BAZAR','VVNAGAR');
insert into customer_mst values('ANA003','RODRICKS','TOWN HALLROAD','ANAND');

No comments:

Post a Comment