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

RDBMS, what is RDBMS? how it works? good example.

what is RDBMS? how it works? good example.

Attributes and tuple, Before we talk about the relational model in more det...

Before we talk about the relational model in more detail, let us first define some very basic terms used in this model. Tuple Every row in a table shows a record and is cal

Determine the operation that do not participate to be union, 1. Which relat...

1. Which relational algebra operations do not need the participating tables to be union-compatible? Ans: Join is the relational algebra operations that do not need the particip

Physical records, Physical Records These are the records that are store...

Physical Records These are the records that are stored in the secondary storage devices. For the database relation, physical records are the group of fields kept in adjacent me

List some instances of collection types, List some instances of collection ...

List some instances of collection types? a) sets b) arrays c) multisets

Accounting and external reporting, List the internal controls that should b...

List the internal controls that should be in effect solely because a EDP system is employed, classifing them as (1) Those controls pertaining to input of information and (2) All ot

What is difference between truncate and delete, What is difference between ...

What is difference between TRUNCATE and DELETE? - Truncate can't be rolled back whereas Delete can be. - Truncate keeps the lock on table whereas Delete keeps the lock on ea

Define shared locks, Define Shared locks? Ans: Shared lock: Throughout ...

Define Shared locks? Ans: Shared lock: Throughout concurrent execution of transactions, earlier than a transaction can access a data item, it has to obtain a lock on it. Now he

What is meant by software and hardware raid systems, What is meant by softw...

What is meant by software and hardware RAID systems? RAID can be executed with no change at the hardware level, using only software modification. Such RAID implementations are

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