Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

(a) This part of the question is concerned with the request to obtain for each course for which at least one assignment has been submitted,

image text in transcribed

(a) This part of the question is concerned with the request to obtain for each course for which at least one assignment has been submitted, the course code and the identifiers of students who have submitted at least one assignment for that course. Explain why the table you obtain from executing the following query does not in general represent a relation. SELECT student_id, course_code FROM assignment Amend the query so that it answers the same request but the resultant table will represent a relation. (2 marks) (b) Write SQL queries to answer the following requests. In each case, make sure that the result table represents a relation and include that table with your answer. (1) "Give the identifier and mark for each student who in assignment 1 of the course c4 received a mark which was either less than 50 or greater than 85." (3 marks) (ii) "Give the name of each drug which is prescribed for low temperature." (4 marks) (iii)"For each ward, give its name and the number of nurses working on it." (5 marks) (iv) For each student, give the student identifier and the total number of credits of the courses on which the student is enrolled provided this total is greater than 60." (5 marks) (c) Give an English expression of the request that would be satisfied by the following query and describe the logical processing of the query. SELECT d.staff_no, doctor_name, type, COUNT(*) AS number_of_prescriptions FROM doctor d, prescription p, drug dr WHERE p.staff_no = d.staff_no AND p.drug_code dr. drug_code GROUP BY type, d. staff_no, d.doctor_name HAVING COUNT(*) > 1 (6 marks)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Learning PostgreSQL

Authors: Salahaldin Juba, Achim Vannahme, Andrey Volkov

1st Edition

178398919X, 9781783989195

More Books

Students also viewed these Databases questions

Question

=+ Who has this information?

Answered: 1 week ago

Question

LO5 Highlight five external recruiting sources.

Answered: 1 week ago