You are on page 1of 5

ASSIGNMENT -5

TABLES:
QUERIES:

-- 1
select * from track ;
-- 2
select * from track where distance <20;
-- 3
select distinct id from trainhalts where stcode = (select stcode from station
where name='GHATKOPAR');
-- 4
select name from train where id in (select id from trainhalts where
stcode='CST') order by name;

-- 5
select distinct name from station where stcode in (select stcode from
trainhalts where id='A65');

-- 6
select distinct name from train where id in (select id from trainhalts where
seqno<'6');

-- 7
select stcode1,stcode2 from track where distance =(select max(distance) from
track);
-- 8
SELECT id from trainhalts where timeout=(select MAX(timeout) from trainhalts
where timeout < (select MAX(timeout) from trainhalts));

-- 9
DELETE FROM track where stcode1='CST' OR stcode2='CST';
DELETE FROM station where stcode='CST';
DELETE FROM trainhalts where stcode='CST';
-- 10
DELETE FROM train where id='KP11';
DELETE FROM trainhalts where id='KP11';

You might also like