Execute sql queries, Database Management System

Assignment Help:

Consider the relations described below:
PHYSICIAN (regno, name, telno, city)
PATIENT (pname, street, city)
VISIT (pname, regno, date_of_visit, fee)
Where the regno and pname identify the physician and the patient uniquely corresponding. Express queries (i) to (iii) in SQL.
(i) Get the name and regno of physicians who are in Delhi.
(ii) Find out the name and city of patient(s) who visited a physician on 31 August 2004.
(iii) Get the name of the physician and the total number of patients who have visited her.
(iv) What does the subsequent SQL query answer
SELECT DISTINCT name
FROM PHYSICIAN P
WHERE NOT EXISTS
( SELECT *
FROM VISIT
WHERE regno = p.regno )

(i) Select name, regno from PHYSICIAN where city = ‘Delhi';
(ii) Select pname, city from PATIENT,VISIT where PATIENT.pname=VISIT.pname and date_of_visit = '31-Aug-04';
(iii) select name, count(*) from PHYSICIAN, VISIT where PHYSICIAN.regno = VISIT.regno group by Physician . regno;
(iv) This will provide the name of physicians who have not visited any patient.


Related Discussions:- Execute sql queries

Describe log based recovery, Describe log based recovery The most usabl...

Describe log based recovery The most usably structure for recording data base modification is the LOG the log is a sequence of log records recording all the update activities i

What are the time stamps associated with each data item, What are the time ...

What are the time stamps associated with each data item? W-timestamp (Q) denotes the largest time stamp if any transaction that implemented WRITE (Q) successfully. R-timesta

What is icr, What is ICR? A. ICR (Intelligent Character Recognition) is...

What is ICR? A. ICR (Intelligent Character Recognition) is a technology that gives scanning and imaging systems the ability to identify images of hand-printed or script charact

What are the advantages of object oriented databases, What are the advantag...

What are the advantages of object oriented databases in comparison with others? Why it is still not widely used? Object oriented designs are coherent, efficient and less prone

System Analysis and design, Using the questions found at the end of Chapter...

Using the questions found at the end of Chapter 9 in your textbook, complete this homework activity. Students will submit a Word document answering questions 2, 3, and 4.

Column constraints-on delete cascade, CREATE TABLE prodtrans ( pno ...

CREATE TABLE prodtrans ( pno number (4) ptype char (1) CHECK (ptype in ('I','R','S')), qty number (5) FOREIGN KEY pno REFERENCES product (pno) ON DELETE CASCADE);

Explain the disadvantages of a file processing system, Explain the disadvan...

Explain the disadvantages of a file processing system? Ans: Disadvantages of File Processing Systems include: 1) Data Redundancy 2) Data Inconsistency 3) Difficult to acce

Mis, explain three types of internet risks to the consummers whent he busin...

explain three types of internet risks to the consummers whent he business system is data dependent. how can we minimise these risks

Define a property that is not a property of transactions, Define a property...

Define a property that is not a property of transactions? Ans: Concurrency is not a property of transactions

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