error whenever I try to import it into MySQL using this code  SELECT store_id AS Store, COUNT(*) AS Num_Customers FROM sakila.customer GROUP BY store_id ORDER BY store_id DESC, COUNT(*) DESC; SELECT film.title AS Title, rental.rental_date AS Rental_Date, rental.return_date AS Return_Date FROM sakila.customer JOIN sakila.rental ON customer.customer_id = rental.customer_id JOIN sakila.inventory ON rental.inventory_id = inventory.inventory_id JOIN sakila.film ON inventory.film_id = film.film_id WHERE customer.first_name = 'JO' AND customer.last_name = 'FOWLER' ORDER BY rental.rental_date ASC; REPLACE VIEW top_rental_films AS CREATE OR SELECT film.title AS FilmTitle, COUNT(rental.rental_id) AS Num_Rentals, AVG(payment.amount) AS Avg_Amt FROM sakila.film JOIN sakila.inventory ON film.film_id = inventory.film_id JOIN sakila.rental ON inventory.inventory_id = rental.inventory_id JOIN sakila.payment ON rental.rental_id = payment.rental_id GROUP BY film.film_id ORDER BY AVG(payment.amount) DESC LIMIT 10;

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Hello I am receiving this error whenever I try to import it into MySQL using this code

 SELECT store_id AS Store, COUNT(*) AS Num_Customers
FROM sakila.customer
GROUP BY store_id
ORDER BY store_id DESC, COUNT(*) DESC;
SELECT film.title AS Title, rental.rental_date AS Rental_Date, rental.return_date AS Return_Date
FROM sakila.customer
JOIN sakila.rental ON customer.customer_id = rental.customer_id
JOIN sakila.inventory ON rental.inventory_id = inventory.inventory_id
JOIN sakila.film ON inventory.film_id = film.film_id
WHERE customer.first_name = 'JO' AND customer.last_name = 'FOWLER'
ORDER BY rental.rental_date ASC;
REPLACE VIEW top_rental_films AS
CREATE OR SELECT film.title AS FilmTitle, COUNT(rental.rental_id) AS Num_Rentals, AVG(payment.amount) AS Avg_Amt
FROM sakila.film
JOIN sakila.inventory ON film.film_id = inventory.film_id
JOIN sakila.rental ON inventory.inventory_id = rental.inventory_id
JOIN sakila.payment ON rental.rental_id = payment.rental_id
GROUP BY film.film_id
ORDER BY AVG(payment.amount) DESC
LIMIT 10;

Could someone help me out with this?

Error
Static analysis:
2 errors were found during analysis.
1. Unexpected keyword. (near "VIEW" at position 8)
2. Unrecognized statement type. (near "VIEW" at position 8)
SQL query: Copy →
REPLACE VIEW top_rental_films AS CREATE OR SELECT film.title AS FilmTitle, COUNT(rental.rental_id) AS Num_Rentals, AVG(payment.amount) AS Avg_Amt FROM sakila.film JOIN sakila.inventory ON film.film_id = inventory.film_id JOIN sakila.rental ON inventory.inventory_id = rental.inventory_id JOIN sakila.payment ON rental.rental_id = payment.rental_id GROUP BY film.film_id
ORDER BY AVG(payment.amount) DESC LIMIT 10;
MySQL said: Ⓡ
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'top_rental_films AS
CREATE OR SELECT film.title AS FilmTitle, COUNT (rental.rent' at line 1
Transcribed Image Text:Error Static analysis: 2 errors were found during analysis. 1. Unexpected keyword. (near "VIEW" at position 8) 2. Unrecognized statement type. (near "VIEW" at position 8) SQL query: Copy → REPLACE VIEW top_rental_films AS CREATE OR SELECT film.title AS FilmTitle, COUNT(rental.rental_id) AS Num_Rentals, AVG(payment.amount) AS Avg_Amt FROM sakila.film JOIN sakila.inventory ON film.film_id = inventory.film_id JOIN sakila.rental ON inventory.inventory_id = rental.inventory_id JOIN sakila.payment ON rental.rental_id = payment.rental_id GROUP BY film.film_id ORDER BY AVG(payment.amount) DESC LIMIT 10; MySQL said: Ⓡ #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'top_rental_films AS CREATE OR SELECT film.title AS FilmTitle, COUNT (rental.rent' at line 1
Expert Solution
steps

Step by step

Solved in 3 steps

Blurred answer
Knowledge Booster
Multiple table
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education