Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CREATE TABLE customers
- (customerid int identity(100,20) not null,
- companyname varchar(40) not null,
- contactname char(30) null,
- address varchar(60) null,
- city char(15) null,
- phone char(24) unique null,
- fax char(24) null,
- constraint unique_name unique(companyname),
- CONSTRAINT prim_customer PRIMARY KEY (customerid)
- );
- create table orders
- (orderid int identity not null PRIMARY KEY,
- customerid int not null,
- orderdate date default getdate() null,
- shippeddate date null,
- freight money null,
- shipname varchar(40) null,
- shipaddress varchar(40) null,
- quantity int null,
- customer_id int,
- CONSTRAINT fk_customer FOREIGN KEY (customer_id)
- REFERENCES customers(customerid));
- alter table orders add shipregion int null;
- alter table orders alter column shipregion char(8) null;
- alter table orders drop column shipregion;
- alter table orders add constraint not_less check(1 < quantity and quantity < 30 );
- alter table orders drop constraint not_less;
- exec sp_rename 'customers.city', 'town', 'COLUMN';
Advertisement
Add Comment
Please, Sign In to add comment