Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

complete the SQL statement below. A table called tickets tracks the number of tickets sold each day at a movie theater. (Each row represents

complete the SQL statement below. A table called  complete the SQL statement below. A table called

complete the SQL statement below. A table called "tickets" tracks the number of tickets sold each day at a movie theater. (Each row represents a different day.) The statement should create a new column called "tickets_yesterday" that includes the "tickets_sold" from the previous day. Within this statement, in addition to this new column, include the date_id and tickets sold. Sort the data by the date_id in ascending order. #1 #2 #3 SELECT date_id, tickets_sold, LAG ( FROM tickets; ) OVER (ORDER BY ) AS complete the SQL statement below. A table called "sales" tracks revenue by year and quarter. (Each row represents quarterly sales in a given year.) The statement should create a new column called "year_over_year" that includes the "quarterly_sales" from a year earlier. (As an example, quarter 4 sales in 2022 would be compared to quarter 4 sales in 2021.) Within the statement, in addition to this new column, include the year, quarter, and quarterly_sales columns. Sort the data by the year and quarter in ascending order. #1 #2 #3 SELECT year, quarter, quarterly_sales, FROM (quarterly_sales, sales; ) OVER (ORDER BY year, quarter) AS

Step by Step Solution

3.47 Rating (154 Votes )

There are 3 Steps involved in it

Step: 1

Here are the completed SQL statements for both scenarios 1 For the tickets table sql SELECT dateid t... 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

Intermediate Microeconomics

Authors: Hal R. Varian

9th edition

978-0393123975, 393123979, 393123960, 978-0393919677, 393919676, 978-0393123968

More Books

Students also viewed these Databases questions

Question

10. How should corrections be made in the general journal?

Answered: 1 week ago