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

Example-revoke all on emp from mca12, Example:  //REVOKE ALL ON EMP FROM MC...

Example:  //REVOKE ALL ON EMP FROM MCA12;                              (All permissions will be cancelled) You can also cancel only some of the permissions. Drop: A user-

Create a table student with attributes student name, Question 1 Create a t...

Question 1 Create a table student with attributes student name, roll number, total marks and percentage. Do the following operations Insert details in to the table Update

Define specialisation and generalization in brief, Define Specialisation an...

Define Specialisation and generalization in brief? Specialisation / generalization: Generalization or Specialization represents the is a relationship set, an necessary element

Define an abstraction, Define an abstraction by which relationships are tre...

Define an abstraction by which relationships are treated as higher level entities Ans: Aggregation.  It is an abstraction by which relationships are treated as higher level

What is multiplicity in the associations, What is multiplicity in the assoc...

What is multiplicity in the associations? Give an example to explain multiplicity? Multiplicity in association indicate number of objects participate in any relationship. For

Process of implementing system design in dynamic models, Process of impleme...

Process of implementing system design in dynamic models There are three essential approaches to implementing system design in dynamic models. These approaches are as below:

Name the three major database in oracle, Name the three major set of files ...

Name the three major set of files on disk that compose a database in Oracle. There are three main sets of files on disk that compose a database. All the files are binary. These

Single valued normalisation, Single Valued Normalisation  Codd in the y...

Single Valued Normalisation  Codd in the year 1972 formed three normal forms (1NF, 2NF, and 3NF). These were based on functional dependencies between the attributes of a relati

Entity relationship, how to write tables and drow E-R diagrams for hosiptal...

how to write tables and drow E-R diagrams for hosiptal management system and how to normalize and cardinalities?

Storage of database on hard disks, Storage Of Database On Hard Disks At...

Storage Of Database On Hard Disks At this point, it is worthwhile to note the difference among the terms file Organisation and the access method. A file organisation shows to t

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