Assignment5 Answer

You might also like

Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 2

create table customer(cust_id varchar2(10) primary key, l_name varchar2(15),f_name

varchar2(15),area varchar2(20),phone_no number(10))

create table movie(mv_no number(10) primary key, title varchar2(15),tpye


varchar2(15),star varchar2(20),price number(6,2))

create table invoice(inv_no varchar2(10) primary key, mv_no number(10),cust_id


varchar2(10),issue_date varchar2(20),return_date varchar2(20), foreign key(mv_no)
references movie(mv_no),foreign key(cust_id) references customer(cust_id))

1> update customer set phone_no ='4663891' where f_name='Vijeta'


2> update movie set price ='450.00' where title='home alone'
3> delete from invoice where inv_no ='i10'
4> delete from invoice where return_date <'8-aug-93'
5> update customer set area ='Lk' where cust_id='a02'
6> update invoice set return_date ='16-oct-93' where inv_no='i04'
7> SELECT l_name FROM customer WHERE l_name LIKE 'S%' or l_name like 'B%'
8> SELECT * FROM customer WHERE area LIKE 'Sa' or area like 'Mu' or area like
'Lk'

9> select * from invoice where issue_date like '%SEP%';


10> select * from movie where type ='horror' and type ='thriller'
11> select * from movie where price>'150' and price<='200'
12> select * from movie order by title;
13> select title, type from movie where type not in 'suspence'
14> select price/(price-300) from movie where title='home alone';
15> select f_name ||' '|| l_name as name ,cust_id ,area from customer where
phone_no is NULL

16> select sum(price)as total ,avg(price) as average from movie


17> select max(price) as max_price ,min(price) as min_price from movie
18> *************
SELECT TITLE, TYPE FROM MOVIE
WHERE TYPE IN(
SELECT TYPE FROM MOVIE
GROUP BY TYPE
HAVING COUNT(TYPE) >=ALL
(SELECT COUNT(TYPE) FROM MOVIE
GROUP BY TYPE));

19> select count(title) as NO_OF_MOVIE from movie where price>=150


20> select type , avg(price) as average from movie group by type
21> select type , count(title) as NO_OF_MOVIE from movie group by type
22> select type , count(title) as NO_OF_MOVIE from movie where type ='comedy' or
type ='thriller' group by type
23> select avg(price ) as average_price ,type from movie where price>'150' group
by type
24> select type , count(title) as NO_OF_MOVIE from movie where type ='comedy' or
type ='thriller' group by type

25> select sysdate - return_date from invoice


create table customer(cust_id varchar2(10) primary key, l_name varchar2(15),f_name
varchar2(15),area varchar2(20),phone_no number(10))

create table movie(mv_no number(10) primary key, title varchar2(15),tpye


varchar2(15),star varchar2(20),price number(6,2))

create table invoice(inv_no varchar2(10) primary key, mv_no number(10),cust_id


varchar2(10),issue_date varchar2(20),return_date varchar2(20), foreign key(mv_no)
references movie(mv_no),foreign key(cust_id) references customer(cust_id))

insert into customer values('a06','','James','Gh',5125274)

insert into movie values(10, 'carry on doctor','comedy','leslie phillips','100')

insert into invoice values('i10','8', 'a06', '03-sep-93','06-sep-93')

select * from invoice

update movie set price ='450.00' where title='home alone'

delete from invoice where inv_no ='i10'

modify

alter table "MOVIE" rename column


"TPYE" to "TYPE"
/

You might also like