Answered step by step
Verified Expert Solution
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 "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...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started