Question

In: Computer Science

5. Write the SQL query that accomplishes the task in the ZAGI Retail Company Sales Department...

5. Write the SQL query that accomplishes the task in the ZAGI Retail Company Sales Department Database:

5.1.3. Display the CustomerName and CustomerZip for all customers, sort alphabetically by CustomerName.

5.1.4. Display the RegionID of regions where we have stores (use only table STORES and do not display the same information more than once).

5.1.5 Display all the information for all stores whose ReigionID value is C

5.1.8 Display the ProductID, ProductName, ProductPrice, and VendorName for all products. Sort the results by ProductID.

5.1.10 Display the ProductID, ProductName, and ProductPrice for products in the category whose CategoryName value is Camping. Sort the results by ProductID.

5.1.11 Display the ProductID, ProductName, and ProductPrice for products that were sold in the zip code 60600. Sort the results by ProductID

Solutions

Expert Solution

5.1.3. Display the CustomerName and CustomerZip for all customers, sort alphabetically by CustomerName.

Ans:-

SELECT CustomerName,CustomerZip FROM customers ORDER BY CustomerName ASC;

5.1.4. Display the RegionID of regions where we have stores (use only table STORES and do not display the same information more than once).

Ans:

SELECT DISTINCT RegionID FROM STORES;

5.1.5 Display all the information for all stores whose ReigionID value is C

Ans:-

SELECT * FROM STORES WHERE RegionID = 'C';

5.1.8 Display the ProductID, ProductName, ProductPrice, and VendorName for all products. Sort the results by ProductID.

Ans:

SELECT ProductID,ProductName,ProductPrice,VendorName FROM products ORDER BY ProductID ASC;

5.1.10 Display the ProductID, ProductName, and ProductPrice for products in the category whose CategoryName value is Camping. Sort the results by ProductID.

Ans:

SELECT ProductID, ProductName,ProductPrice FROM products WHERE CategoryName="Camping" ORDER BY ProductID ASC;

5.1.11 Display the ProductID, ProductName, and ProductPrice for products that were sold in the zip code 60600. Sort the results by ProductID

Ans:

SELECT ProductID,ProductName,ProductPrice FROM products WHERE ZipCode=60600 ORDER BY PoductID ASC;


Related Solutions

How to write a query in SQL using the Group by function to decide if the...
How to write a query in SQL using the Group by function to decide if the results of the diet worked. There are 6 columns ID, Gender, treatment, start_weight_kg, end_weight_kg, and correct change (end weight minus start weight). With the information given write a SQL to determine if the the results(correct change) worked. Question is not incomplete.
1. Write a query in SQL to find the full name of the “Actors” who appeared...
1. Write a query in SQL to find the full name of the “Actors” who appeared in the movie titled Star Wars (using JOIN ). 2.Write a SQL query to find the movie Title that has received Lowest rating from reviewers, but whose actors have received an award for their contribution in movie. (Expected Output: Fantastic Beasts and Where to Find Them) 3.Write a SQL query that display the list of genres, Number of movies in that genre grouped by...
In sql: Write a query to produce a listing of unique vendor names who have at...
In sql: Write a query to produce a listing of unique vendor names who have at least one invoice with us. You are using a table view called COMPANY_INFORMATION that lists a vendor id, vendor name, term id, and term description. The second table you will reference is the invoice table that lists vendor id, invoice num, invoice number, and invoice total. Do not show duplicate results.
Write an SQL query that will output the employee id, first name and hire date from...
Write an SQL query that will output the employee id, first name and hire date from the employee table. Pick only those employees whose employee ID is specified in the employee table (no nulls). If the employee id is 777, name is ABC and hire date is 01-JAN-2016, the output should be like - ' ABC (Employee ID - 777) was hired on 1, January of 2016'. Note - The date should not have preceding zeros.
Write a SQL query to find the movie Title that has received Lowest rating from reviewers,...
Write a SQL query to find the movie Title that has received Lowest rating from reviewers, but whose actors have received an award for their contribution in movie. Output: Fantastic Beasts and Where to Find Them            //   THE DATABASE // DROP DATABASE IF EXISTS cs431_movie_database; CREATE DATABASE cs431_movie_database; USE cs431_movie_database; CREATE TABLE `artists` ( `artist_id` INT NOT NULL AUTO_INCREMENT, `first_name` varchar(45) NOT NULL, `last_name` varchar(45) NOT NULL, `contact_no` varchar(15) DEFAULT NULL, `Profession` TEXT DEFAULT NULL, `birth_date` datetime DEFAULT NULL,...
1.Write an SQL query that retrieves all pairs of suppliers who supply the same product, along...
1.Write an SQL query that retrieves all pairs of suppliers who supply the same product, along with their product purchase price if applicable. 2.Create a view SUPPLIEROVERVIEW that retrieves, for each supplier, the supplier number, the supplier name, and the total amount of quantities ordered. Once created, query this view to retrieve suppliers for whom the total ordered quantity exceeds 30. 3.Write a nested SQL query to retrieve all purchase order numbers of purchase orders that contain either sparkling or...
Internal Controls for Cash Received from Retail Sales Dunn Company operates a retail department store. Most...
Internal Controls for Cash Received from Retail Sales Dunn Company operates a retail department store. Most customers pay cash for their purchases. Edwards has asked you to help it design procedures for processing cash received from customers for cash sales. Briefly describe the procedures that should be used in each of the following departments: a. Retail sales departments b. Retail sales supervisor c. Treasurer’s department d. Controller’s department
Homework: Populate Sales Order tables. Write SQL to : 1. insert 5 records in each table:...
Homework: Populate Sales Order tables. Write SQL to : 1. insert 5 records in each table: Market, Region, ProductFamily, Manager (all Managers must have different % commissions, Commission is an attribute of the Manger). 2. Insert 5 records in Agent using all Managers 3. Insert 15 records in Product using  all ProductFamily 4. Insert 15 records in Customer using various Regions and Markets 5. Insert 50 records in SalesOrder using various Customers, Products, Agents Notes : ALL the Names ( Description)...
Write a c++ program for the Sales Department to keep track of the monthly sales of...
Write a c++ program for the Sales Department to keep track of the monthly sales of its salespersons. The program shall perform the following tasks: Create a base class “Employees” with a protected variable “phone_no” Create a derived class “Sales” from the base class “Employees” with two public variables “emp_no” and “emp_name” Create a second level of derived class “Salesperson” from the derived class “Sales” with two public variables “location” and “monthly_sales” Create a function “employee_details” under the class “Salesperson”...
Write the SQL DDL to create the following 5 tables for an App store: Publisher, Category,...
Write the SQL DDL to create the following 5 tables for an App store: Publisher, Category, App, AppVersion, AppVersionReview: A Publisher table where each publisher is identified by an integer id and has a name (up to 40 characters). (1 mark) A Category table where each category has an id (integer), a name (up to 50 characters), and a parentId to identify its parent category. The parentId should be a foreign key to the Category table. (1.5 marks) An App...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT