Question: MY SQL QUERY REQUIRED Create a procedure SuburbBestCustomer() to list the best customer for each suburb. The best customer is the customer who spent the
MY SQL QUERY REQUIRED
Create a procedure SuburbBestCustomer() to list the best customer for each suburb. The best customer is the customer who spent the largest amount in the restaurant. The list should be sorted in descending order.
given following tables with following attributes
CREATE TABLE customer(
Phone number Bigint primary key not null,
first name varchar(255),
Lastname varchar(255)
);
create table customeraddress(
customerphone bigint primary key not null,
StreetNumber int,
Streetname varchar(225),
suburb varchar(225)
create table pizza(
pizzaid bigint primary key not null,
baseprice int,
crust varchar(225),
pizzaname varchar(225),
);
create table nonpizza(
productcode int primary key not null,
manafacturing varchar(225),
prices float,
details varchar(225),
supplier varchar(225),
Pizzaid int
);
create table orderrestaurant(
orderid int primary key not null,
amount int,
size int,
pizzaid int,
nonpizzaid int,
ingredientsid bigint
);
create table ingredients(
ingredients id bigint primary key,
ingredientname varchar(20),
manafacturing varchar(20),
price float,
pizza id
);
total price of oder is non pizza+pizza+ingredients
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
