Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
8 views4 pages

Assignment 6 Q5

Assignment

Uploaded by

Sam
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views4 pages

Assignment 6 Q5

Assignment

Uploaded by

Sam
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

/* Assignment 6 Q5*/

create table Room(roomno integer primary key, descri varchar(30), rate integer);

desc Room

/* Output:

TABLE ROOMResult Set 1

Column Null? Type

ROOMNO NOT NULL NUMBER

DESCRI - VARCHAR2(30)

RATE - NUMBER

Download CSV

3 rows selected. */

create table Guest(gno integer primary key, gname varchar(30), no_of_days integer
check(no_of_days>0), roomno integer references Room(roomno));

desc Guest

/* Output:

TABLE GUESTResult Set 2

Column Null? Type

GNO NOT NULL NUMBER

GNAME - VARCHAR2(30)

NO_OF_DAYS - NUMBER

ROOMNO - NUMBER

Download CSV

4 rows selected.

*/

insert into Room(roomno,descri,rate) values(1,'Simple',500);

insert into Room values(2,'AC',1000);


insert into Room values(3,'NON AC',1500);

insert into Room values(4,'Ac',2000);

insert into Room values(5,'NON AC',1500);

select * from Room;

/* Output:

Result Set 3

ROOMNO DESCRI RATE

2 AC 1000

3 NON AC 1500

4 Ac 2000

5 NON AC 1500

1 Simple 500

Download CSV

5 rows selected.*/

insert into Guest(gno,gname,no_of_days,roomno) values(1,'Chaitrali',4,1);

insert into Guest values(2,'Bhalchandra',3,2);

insert into Guest values(3,'Manisha',2,3);

insert into Guest values(4,'Manini',2,4);

insert into Guest values(5,'Pradip',4,5);

select * from Guest;

/* Output:

Result Set 4

GNO GNAME NO_OF_DAYS ROOMNO

1 Chaitrali 4 1
2 Bhalchandra 3 2

3 Manisha 2 3

4 Manini 2 4

5 Pradip 4 5

Download CSV

5 rows selected.*/

/* Q1*/

select * from Room order by (rate);

/* Output:

Result Set 5

ROOMNO DESCRI RATE

1 Simple 500

2 AC 1000

3 NON AC 1500

5 NON AC 1500

4 Ac 2000

Download CSV

5 rows selected.

*/

/* Q2*/

select * from Guest where no_of_days>3;

/* Output:

Result Set 6

GNO GNAME NO_OF_DAYS ROOMNO

1 Chaitrali 4 1

5 Pradip 4 5

Download CSV
2 rows selected.*/

/* Q3*/

select count(roomno) from Room where descri='AC';

/* Output:

Result Set 8

COUNT(ROOMNO)

Download CSV*/

/* Q4*/

select sum(rate) from Room where descri='NON AC';

/* Output:

Result Set 9

SUM(RATE)

3000

Download CSV*/

/* Q5*/

select gname from Guest,Room where Room.roomno=Guest.roomno and rate=(select max(rate)


from Room);

/* Output:

Result Set 1

GNAME

Manini

Download CSV*/

You might also like