Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

CREATE TABLE prodhierarchy ( level1 varchar(80), level2 varchar(80), level3 varchar(80) not null primary key); CREATE TABLE pceprod ( prod varchar(80) not null, year int not

CREATE TABLE prodhierarchy ( level1 varchar(80), level2 varchar(80), level3 varchar(80) not null primary key); CREATE TABLE pceprod ( prod varchar(80) not null, year int not null, quarter int not null, pce int, primary key(prod,year,quarter), foreign key(prod) references prodhierarchy ); CREATE TABLE pcefunc ( func varchar(80) not null, year int not null, quarter int not null, pce int, primary key(func,year,quarter) ); 

write exactly one SQL query to answer

What is the function, year, and PCE with the most annual PCE ? The result should have the columns: func, year, annualpce.

image text in transcribed

sample data

20! 2010 3394 350619 Clothing footw Clothing footwear Clothing footwear Clothing footwear Clothing footwear Clothing footwear Communication Communication Communication Communication Communication Communication Education Education Education Education Education Education Financial services a Financial services a Financial services Financial services a Financial services a Financial services a Food and beverage Food and beverage Food and beverage Food and beverage Food and beverage 2010 352367 339544 4342627 236389 234415 235756 233741 233755 4 232854 228588 240759 231422 244559 234792 236732 816479 824943 813314 829936 809265 4 816332 773838 797365 2010 2010 2010 2010 2010 2010 2010 2774152 794638 2010 3777001

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

Students also viewed these Databases questions