Determine how many products reside in each subcategory

Assignment Help Database Management System
Reference no: EM131765569

Terms

Define the following terms:

1. Implicit syntax vs. Explicit syntax
2. Table alias
3. Qualified column name
4. Inner JOIN vs Outer JOIN vs FULL JOIN
5. Self-join
6. UNION
7. Aggregate function (with two examples)
8. Summary query
9. INTERSECT vs EXCEPT
10. HAVING

Exercise 1 Determine how many products you can find in the Production.Product table.

504
(1 row(s) affected)

Exercise 2 Write a query that retrieves the number of products in the Production.Product table that are included in a subcategory.

Hint: the rows that have NULL in column ProductSubcategorylD are considered not a part of any subcategory.
HasSubCategorylD
295
(1 row(s) affected)
Notice that the result has a column name. Also take a look at the message you receive from SQL Server.

Exercise 3 Determine how many Products reside in each SubCategory.

The answer to this is retrievable if you write a query that uses the COUNT aggregate function combined with a GROUP BY clause.

The column ProductSubcategorylD is a candidate for building groups of rows when querying the Production.Product table. Your result set should look something like the result below:

Notice the column alias for the second column.

ProductSubcategorylD   Counted Products
NULL 209
1 32
2 43
(38 row(s) affected)

Exercise 4 Write a query that lists the country and province names stored in AdventureWorks2014 sample database.

In the Person schema, you will find the CountryRegion and StateProvince tables. Join them and produce a result set similar to the following. Notice that there is no particular sort order in the result set.
Country  Province
Canada  Alberta
United States  Alaska
United States  Alabama
(181 row(s) affected)

Exercise 5 Continue to work with the previous query and add a filter to list only the countries Germany and Canada.

Also, notice the sort order and column headings of the result set. Your result set should look similar to the following:

Country  Province
Canada  Alberta
Canada  British Columbia

Germany Brandenburg
Germany  Hamburg
(20 row(s) affected

Exercise 6 Write a query that retrieves the average commission percent for the SalesPerson table.

Exercise 7 Write a query that retrieves a count of all Male Employees. Name the column.
Hint: Use a HumanResources table.

Exercise 8 Write a query that retrieves the highest List Price and lowest List Price of any Product in the Production.Product table.

Column names should be Max List Price and Min List Price. Min List Price cannot be 0.00.
Exercise 9 Identify the possible causes of error(s) and rectify. Consider the following SQL query:
SELECT ProductlD, LineTotal AS 'Total'
FROM Sales.SalesOrderDetail
Group By Cube(LineTotal)
Once executed, the preceding query generates errors. Identify the possible causes of such error(s) and rectify.
ProductID  Total
707  157772.394392
708  160869.517836
718  395182.699300
(267 row(s) affected

Reference no: EM131765569

Questions Cloud

What is customer service management process : What is customer service management process? List five activites thay may be considered part of that process
Determine the commercial banking system causes : The time necessary for a deposited check to clear through the commercial banking system causes which of the following types of floats?
Developing a country risk analysis : Why are trade theories important in developing a country's risk analysis?
Compute stiner company materials quantity variance : Stiner Company has a materials price standard of $2.00 per pound. Stiner Company's materials quantity variance is
Determine how many products reside in each subcategory : Determine how many products you can find in the Production - Write a query that retrieves the number of products in the Production
How much net interest income profit did wamu earn : How much net interest income (profit) did WaMu earn in the first quarter of 2006 on this deposit and the corresponding loan
Total quality management used for in company : What is a tool like Total Quality Management used for in a company?
What is your response to the boosters : What is your response to the President? What is your response to the Boosters?
What strategies would you use to keep morale high : What strategies would you use to keep morale high? What theory(ies) of motivation would you utilize to achieve this?

Reviews

Write a Review

Database Management System Questions & Answers

  Knowledge and data warehousing

Design a dimensional model for analysing Purchases for Adventure Works Cycles and implement it as cubes using SQL Server Analysis Services. The AdventureWorks OLTP sample database is the data source for you BI analysis.

  Design a database schema

Design a Database schema

  Entity-relationship diagram

Create an entity-relationship diagram and design accompanying table layout using sound relational modeling practices and concepts.

  Implement a database of courses and students for a school

Implement a database of courses and students for a school.

  Prepare the e-r diagram for the movie database

Energy in the home, personal energy use and home energy efficiency and Efficient use of ‘waste' heat and renewable heat sources

  Design relation schemas for the entire database

Design relation schemas for the entire database.

  Prepare the relational schema for database

Prepare the relational schema for database

  Data modeling and normalization

Data Modeling and Normalization

  Use cases perform a requirements analysis for the case study

Use Cases Perform a requirements analysis for the Case Study

  Knowledge and data warehousing

Knowledge and Data Warehousing

  Stack and queue data structure

Identify and explain the differences between a stack and a queue data structure

  Practice on topic of normalization

Practice on topic of Normalization

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd