Create a table to record a passengers information, Database Management System

Assignment Help:

Given the following relations
TRAIN (NAME, START, DEST)
TICKET (PNRNO., START, DEST, FARE)
PASSENGER (NAME, ADDRESS, PNRNO.)
Write SQL expressions for the following queries:
Note: Assume NAME of Train is a column of Ticket.
(i) List the names of passengers who are travelling from the begin to the destination station of the train.
(ii) List the names of passengers who have a return journey ticket.
(iii) Insert a new Shatabti train from Delhi to Bangalore.
(iv) Cancel the ticket of Tintin.

(i) SELECT P.NAME FROM TRAIN T, TICKET I, PASSENGER P
WHERE P.PNRNO = I.PNRNO AND T.NAME = I.NAME
AND T.START = I.START AND T.DEST = I.DEST
(ii) SELECT NAME FROM PASSENGER
WHERE PNRNO IN (SELECT DISTINCT A.PNRNO
FROM TICKET A, TICKET B WHERE A.PNRNO = B.PNRNO
AND A.START = B.DEST AND A.DEST = B.START)
(iii) INSERT INTO TRAIN
VALUES(‘Shatabdi', ‘Delhi', ‘Banglore'
(iv) DELETE FROM TICKET
WHERE PNRNO = (SELECT PNRNO FROM PASSENGER
WHERE NAME = ‘Tintin')


Related Discussions:- Create a table to record a passengers information

Answer, Describe multi key files

Describe multi key files

Research in Concurency Control Protocols, Performance of Various Concurrenc...

Performance of Various Concurrency Control Mechanisms

Student database, tell me the functionality,advantages and disadvantages of...

tell me the functionality,advantages and disadvantages of student database

Ans the following, discuss the array implementation of a stack.

discuss the array implementation of a stack.

Three levels of ANSI-SPARC architecture, a need some real life examples of...

a need some real life examples of database management systems three level of ANSI SPARC architecture life teacher and student ,company and employee or for NGO etc.

Create an entity relationship diagram, Cyber Transit Ltd keeps up-to-date i...

Cyber Transit Ltd keeps up-to-date information on the processing and current position of each dispatched item. Dispatched items are the main concern of the Cyber Transit product tr

Explain candidate key, Explain Candidate key? Candidate Key - A candi...

Explain Candidate key? Candidate Key - A candidate key is a minimal superkey, that can be used to uniquely identify a tuple in the relation.

Multi-list file organisation, Multi-list file Organisation Multi-list f...

Multi-list file Organisation Multi-list file organisation is a multi-index linked file organisation. A linked file organisation is a logical organisation where physical orderin

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd