Você está na página 1de 2

1)create table customer_dept ( customer_dept_id integer not null, customer_dept_name varchar(10) ) unique primary index customer_upi(Customer_id,customer_dept_id) 2)create table

customer ( customer_id integer not null, customer_name varchar(20) not null, customer_expense integer, customer_phone_num integer, customer_dept_id integer ) 3) Inserting values under customer_dept ********* insert into customer_dept values(300,'Sales') Inserting values under customer *********** insert into customer values(2,'Kell',386,8888,200) insert into customer values(3,'sher',782,7777,100) insert into customer values(4,'hyar',null,6666,300) insert into customer values(5,'whyb',345,5555,300) insert into customer values(6,'vale',675,4444,200) 4)alter table customer add Location varchar(20), add gender char(1) 5)alter table customer drop Location , drop gender 6)alter table customer add constraint cust_check check(customer_expense>10000) showing error 7)alter table customer add constraint cust_check check(customer_expense<200) 8)insert into customer values(5,'whyb',345,5555,400)-->Displaying error (Insert Failed 2700:Referential Constraint voilation :invalid foreign key value) 9)Displaying duplicate primary key error 10)Column customer name is not null give column value 11)alter table customer RENAME customer_phone_num to customer_phone_number 12 displaying error "Column customer_id is an index column and cannot be modifie d" 13)displaying error 14)displaying error "Column customer_id is an index column and cannot be dropped 15)create table customer_1( customer_id integer,customr_name varchar(20)) insert into customer_1(3,'C') 16)insert into customer_2 select * from customer where customer_dept_id=200 17)insert into customer (customer_name,customer_id,customer_phone_number,custome r_dept_id) values ('Gopal',10,1234,300) 18)insert into customer_3 select * from customer 19)delete from customer where customer_dept_id=100 20)select * from dbc.tables where tablename ='Customer' or tablename ='Custome r_1' or tablename ='Customer_2' and databasename='sample' 21) 1.select * from dbc.columns where tablename = 'customer' and databasename='s amples' 2.select * from dbc.columns 3.select * from dbc.columns where tablename = 'customer'

22)delete from customer_3 23)update customer_2 set customer_name='XXX' where customer_id=2 24) update customer_2 set customer_expense=0 25)select * from customer order by customer_id asc 26)select * from customer order by customer_dept_id desc 27)select customer_dept_id from customer group by customer_dept_id having COUNT( customer_dept_id)>1 28)select * from customer where customer_dept_id=200 29)select * from customer where customer_expense>300 30)select * from customer where customer_id between 2 and 5 31)select * from customer where customer_dept_id = 300 or customer_dept_id=200 select * from customer where customer_dept_id in( 300,200) select * from customer where customer_dept_id between 200 and 300 32)select * from customer where customer_dept_id not in( 100,200) select * from customer where customer_dept_id <> 100 and customer_dept_i d<>200 33)select * from customer where customer_dept_id =200 or customer_expense <700 34)select * from customer where customer_dept_id =200 or customer_expense <700 35)select * from customer where customer_expense is null 36)select * from customer where customer_expense is not null 37)select * from customer where customer_name like '%r%' 38)select * from customer where customer_name like '%R%' 39)select * from customer where customer_name like 'Y_' 40)

Você também pode gostar