Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Consider the following schema: Person (pid integer, name string). Observer (pid: integer), Meteorologist (pid: integer); Consumer (pid: integer); Lives At (streetAddress: string, city string, state

image text in transcribed

Consider the following schema: Person (pid integer, name string). Observer (pid: integer), Meteorologist (pid: integer); Consumer (pid: integer); Lives At (streetAddress: string, city string, state string, pid: integer.); Forecast (fid: string, high: integer, low: integer, fdate: date, city string): Presents (pid: integer, fid: integer); Views (pid integer, fid: integer): Records (pid integer, oid integer, method: string): This represents a subset of the schema that was used in Project 1. Select a correct Oracle SQL query to count the number of forecasts that meteorologists have presented and not viewed. In order for a forecast to be counted, it must have been presented by the meteorologist and that same forecast must not have been viewed by that meteorologist. List the pid and the count. SELECT P.pid, COUNT (DISTINCT R. fid) AS NUMBER FORECASTS FROM Person P, Meteorologist M, Present R WHERE p.pid = M.pid AND M.pid = R.pid GROUP BY P.pid SELECT b.pid, Count (DISTINCT V. fid) AS NUMBER_FORECASTS FROM Person P, Meteorologist M Views V WHERE P.pid = M.pid AND M.pid - V. pid GROUP BY P.pid none of these SELECT P.pid, count (DISTINCT R. fid) AS NUMBER FORECASTS FROM Person P, Meteorologist M, Present R WHERE P.pid M.pid AND M.pid R.pid AND M.pid NOT IN (SELECT V.pid FROM Views V WHERE v. fid R. fid) GROUP BY P.pid SELECT P.pid, Count (DISTINCT R. fid) AS NUMBER FORECASTS FROM Pengon B, Meteorologist M, Present R, Views V WHERE p.pid = M.pid AND M.pid = R.pid AND P.pid = Vipid GROUP BY F.pid

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

Step: 3

blur-text-image

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

Databases In Networked Information Systems 6th International Workshop Dnis 2010 Aizu Wakamatsu Japan March 2010 Proceedings Lncs 5999

Authors: Shinji Kikuchi ,Shelly Sachdeva ,Subhash Bhalla

2010th Edition

3642120377, 978-3642120374

More Books

Students also viewed these Databases questions