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

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
Get step-by-step solutions from verified subject matter experts
