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 sequential file organization, Describe sequential file organizatio...

Describe sequential file organization.  Explain the rules for (i)  Inserting a new record. (ii)  Deleting an existing record.          Ans:A sequential f

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

Deadlock prevention, Deadlock Prevention One of the easiest approaches ...

Deadlock Prevention One of the easiest approaches for avoiding a deadlock would be to obtain all the locks at the begin of the transaction. Though, this approach restricts conc

What is the use of group by clause, What is the use of group by clause? ...

What is the use of group by clause? Group by clause is used to be relevant aggregate functions to a set of tuples. The attributes given in the group by clause are used to shape

#title using the invoice, using the invoice table shown below,write the rel...

using the invoice table shown below,write the relational schema,draw a dependencies,inclunding all partial and transitive dependencies.assume that the table does not contain repeat

Create a view containing name and number of department, Create a view emp_d...

Create a view emp_dep containing e_name and number of dependents from the tables employee and dependent of (i) CREATE VIEW emp_dept AS SELECT ename, COUNT(*) FROM employee, dep

Discuss the mechanism to read data from and write to a disk, Discuss the me...

Discuss the mechanism to read data from and write to a disk? Disk read/write heads are mechanisms in which read data from or write data to disk drives. The heads have gone by

Computer, 1. Will you advise that your organization uses open source softwa...

1. Will you advise that your organization uses open source software and why? 2. Why is it important for business managers to have a basic understanding of the software development

Define the attribute inheritance, Define the Attribute Inheritance The ...

Define the Attribute Inheritance The attributes of a higher level entity set are inherited through a lower level entity set made by specialization-generalization hierarchy. Nam

Explain data independence, Explain data independence ? Data independenc...

Explain data independence ? Data independence is the capacity to modify the schema at one stage of a database system without having to change the schema at the further level.

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