Question

PLEASE ANSWER IN MYSQL WORKBENCH For each Invoice in the database list the InvoiceId, the InvoiceDate,...

PLEASE ANSWER IN MYSQL WORKBENCH
For each Invoice in the database list the InvoiceId, the InvoiceDate, the CustomerId, and Total. Also include the customer's LastName, and Country. Add a clause so that the result is sorted by country A-Z, and within each country by invoice total - largest to smallest.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

/*creating table*/

CREATE DATABASE Invoice;

/*Use Database*/

USE Invoice.

/*creating table*/

CREATE TABLE Invoice(
-> Invoice_id INT NOT NULL AUTO_INCREMENT,
-> Customer_id INT NOT NULL AUTO_INCREMENT,
-> Customer_lastname VARCHAR(20) NOT NULL,
-> Country VARCHAR(40) NOT NULL,
-> Invoice_date DATE,
-> Total INT,
-> PRIMARY KEY ( Invoice_id )
-> );

/*query*/

select * from Invoice where Country IN(select Country, Total from Invoice GROUPBY Country ORDERBY Total DESC) oreder by Country ASC;

Add a comment
Know the answer?
Add Answer to:
PLEASE ANSWER IN MYSQL WORKBENCH For each Invoice in the database list the InvoiceId, the InvoiceDate,...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • 8. Use the Access_Practice.accdb database to complete the following tasks in Access. O LO 4-2 a....

    8. Use the Access_Practice.accdb database to complete the following tasks in Access. O LO 4-2 a. The database contains three tables containing information about this company's sales process: Inventory, Sales, and Salesitems. Use the Relationships window to link the tables together. b. The Salesltems table records the quantity and price of each item sold on each sale (sales may include more than one item). Calculate the extended amount of sale (call it Amt) for each item (Quantity * UnitPrice). Include...

  • Create a series of ER Diagrams using MySQL Workbench. Each question below is a different version...

    Create a series of ER Diagrams using MySQL Workbench. Each question below is a different version of the same database, with each version increasing in complexity. You need to submit an ER diagram for each version, in pdf or png format. The easiest would be to export your diagrams as png format and insert them into an MS Word document. For each ER diagram clearly indicate primary keys, foreign keys, and relationships, including cardinality (i.e. 1-to-many). Indicate in your diagram...

  • Using the database: Write SQL queries for each of the questions below. 1. Find the media...

    Using the database: Write SQL queries for each of the questions below. 1. Find the media type which has 100 or more tracks. Print the name of such media type. Number of rows returned in the result = 3 A) Find the playlists which have one or more tracks that have never been purchased in California (CA). Print the Id, and the name of such playlists. Number of rows returned in the result = 18 B) Find the customers who...

  • The Northwind database created by Microsoft contains the sales data for a fictitious company called Northwind...

    The Northwind database created by Microsoft contains the sales data for a fictitious company called Northwind Traders, which imports and exports specialty foods from around the world. Here is the schema of the database: Products (ProductID, ProductName, SupplierID, CategoryID, QuantityPerUnit, UnitPrice, UnitsInStock, UnitsOnOrder, ReorderLevel, Discontinued); Suppliers (SupplierID, CompanyName, ContactName , ContactTitle, Address, City, Region, PostalCode, Country, Phone, Fax, HomePage); Categories (CategoryID, CategoryName, Description, Picture); Orders (OrderID, CustomerID, EmployeeID, OrderDate, RequiredDate, ShippedDate, ShipVia,  Freight, ShipName,ShipAddress, ShipCity, ShipRegion, ShipPostalCode, ShipCountry); Order_details (ID, OrderID,...

  • Hi i need Help. i use MYSQL command line. THE QUESTION ARE BELOW please check the...

    Hi i need Help. i use MYSQL command line. THE QUESTION ARE BELOW please check the answer before you submit because sometimes query gives error thank you For Full database of SQL you can DOWNLOAD from this link: https://drive.google.com/file/d/1xh1TcBfMtvKoxvJr7Csgnts68fF53Q1t/view?usp=sharing ------------------------------------------------------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- What are the total sales for each year. Note that you will need to use the YEAR function. Order by year with the newest year first. ------------------------------------------------------- How many employees have no customers? ------------------------------------------------------------------ List the total sales for...

  • In mySQL Northwind data base. How many of Northwind's customers, that don't work in sales, are...

    In mySQL Northwind data base. How many of Northwind's customers, that don't work in sales, are explicitly identified as "Manager" in their job title? Please use a subquery. What is the total order price for each order listed in Northwind's database? Add to the previous query. Include the Customer ID and Shipping Name for each order that is totaled in the previous query. Sort the output by Customer ID. Add to the previous query. Include the Title of Courtesy, First...

  • MYSQL DATABASE: 1) Use an OUTER JOIN to join the Products and OrderItems tables, returning a...

    MYSQL DATABASE: 1) Use an OUTER JOIN to join the Products and OrderItems tables, returning a sorted list of product names (prod_name) and the order numbers (order_num) associated with each. 2) Modify number 1 statement so that it returns a total of number of orders for each item ( as opposed to the order numbers). products table: Columns: prod_id char(10) PK vend_id char(10) prod_name char(255) prod_price decimal(8,2) prod_desc text ​orderItems table: Columns: order_num int(11) PK order_item int(11) PK prod_id char(10)...

  • Plz someone answer my database questions post Exercise I (50 pts): This exercise deals with a...

    Plz someone answer my database questions post Exercise I (50 pts): This exercise deals with a database that stores information abhout Hotel Management System. Customer (C email, name, country) Payment (Invoice id. C email, payment method, date) Invoice (Invoice id, starus, invoice description) Has (Bill id, Invoice id) Bill (Invoice id, Bill id, amount, Bname, type, date, reservation id) Reservation (Hotel id., room id. C email, date, period, reservation id) Rooms(Hotel id, room id. price, category) lotel (Hotel id, H...

  • Write an SQL query against the Chinook Database v1.4. Each query must run successfully using DB...

    Write an SQL query against the Chinook Database v1.4. Each query must run successfully using DB Browser for SQLite. Create the exact query below. Must use sub query. I saw that a similar solution for this question used IF and CONCAT functions which do not work and return errors. If it is possible to use the CASE function in place of IF that would be greatly appreciated. Also I really hate to ask but if it could be organized neatly...

  • Plz someone answer my database questions post Exercise I (50 pts): This exercise deals with a...

    Plz someone answer my database questions post Exercise I (50 pts): This exercise deals with a database that stores information abhout Hotel Management System. Customer (C email, name, country) Payment (Invoice id. C email, payment method, date) Invoice (Invoice id, starus, invoice description) Has (Bill id, Invoice id) Bill (Invoice id, Bill id, amount, Bname, type, date, reservation id) Reservation (Hotel id., room id. C email, date, period, reservation id) Rooms(Hotel id, room id. price, category) lotel (Hotel id, H...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT