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: string,

image text in transcribed
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 (rid: 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 My Present R, Views V WHERE P.pid M.pid AND M.pid = r.pid AND p.pid = v.pid GROUP BY P.pid 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 Onone of these SELECT P.pid, Count (DISTINCT V.fid) AS NUMBER_FORECASTS FROM Person , Meteorologist M, Views V WHERE P-pid M.pid AND M.pid V.pid GROUP BY P.pid SELECT P.pid, COUNT (DISTINCT R. fid) AS NUMBER_FORECASTS FROM Person B, Meteorologist M, Present R WHERE p.pid M.pid AND M.pid R.pid GROUP BY P.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

The Manga Guide To Databases

Authors: Mana Takahashi, Shoko Azuma, Co Ltd Trend

1st Edition

1593271905, 978-1593271909

More Books

Students also viewed these Databases questions

Question

=+i. Does it reflect the brand's personality?

Answered: 1 week ago

Question

How is the NDAA used to shape defense policies indirectly?

Answered: 1 week ago