Write queries to retrieve data for tsql

Assignment Help Basic Computer Science
Reference no: EM13829350

Problem:

Write SQL statements that will retrieve the following data from a database, using Subqueries and Joins. Using the Northwind database, write a SQL SELECT statement that will retrieve the data for the following questions:

1. For each order, display the Company Name, City, and the Country for the customer who placed the order.

  • Include the Order Date and the Required Date. Order the results by Company Name in ascending order.
  • 830 rows returned.

2. For each order, list the OrderID, Orderdate, Product Name, UnitPrice, Quantity Ordered, and Total Cost. Label the column 'Product Cost.'

  • For each product (including the discount), only show those orders that were placed in March of 1997.
  • Sort the data by the OrderID, then the Product Name.
  • 77 rows returned.

3. For each order, display the OrderID, ShipName, and the Employee First and Last Name.

  • Order the results by Employee Last Name in descending order, then by Employee First Name in ascending Order, then by OrderID in ascending order.
  • 830 rows returned.

4. Modify the first query to list the orders with customer details, but include all customers even if they have not placed an order.

  • 832 rows returned.

5. List all customers (include CustomerId and Company Name) who have placed less than 5 orders.

  • Include those customers who have placed 0 orders. Name the count field "OrderCount."
  • Order by number of placed orders in reverse order.
  • 18 rows returned.

6. Display the ProductName, and UnitPrice of all products that have a unit price larger than Tarte au Sucre.

  • Order the results by UnitPrice in descending order.
  • 7 rows returned.

7. Display the Customer Name of all customers who have placed orders in 1996.

  • Order the results by Company Name in ascending order.
  • 67 rows returned.

8. Display the OrderID of all orders that where placed after all orders placed by Bottom-Dollar Markets.

  • Order the result by OrderID in ascending order.
  • 28 rows returned.

9. List the Company Name of all U.S.-based customers who are NOT located in the same state (or region) as any of the employees.

  • Order the results by Company Name.
  • 10 rows returned.

10. Display the Product Names of all products that were placed by customers in CA.

  • Order the result by Product Name in ascending order.
  • Eliminate duplicate rows in the results.
  • 10 Rows Returned.

Additional Information:

The question is from Computer Science and it explains about writing SQL queries for retrieving data in TSQL.

Total Word Limit: 338 Words

Reference no: EM13829350

Questions Cloud

Create one method that the server takes a piece of code : Create one method that the server takes a piece of code or data from the user client-side, manipulates it server side after post back, and then provides the manipulated data back to the user.
What is the principal source of legislative guidance : 1.  What is the principal source of legislative guidance that provides "Special Rules for Long-Term Contracts"? 2.  ­What are the three terms that the IRS uses to define "long-term contract" and what do they mean?  3.  What two categories does Sectio..
What is the difference between prejudice and bias : What is the difference between prejudice and bias? What is the difference between prejudice and discrimination? Is Shelly showing prejudice, bias, or discrimination in the scenario above
Sql dml for data modification in tables : Write SQL DML statements that will modify data from within a database. Using the Northwind database, write a SQL DML statement that will modify the data. Base it on the following requirements:
Write queries to retrieve data for tsql : Write SQL statements that will retrieve the following data from a database, using Subqueries and Joins. Using the Northwind database, write a SQL SELECT statement that will retrieve the data for the following questions:
Operating system provides a mechanism for configuring : Operating system provides a mechanism for configuring the behavior of the keyboard attached to the computer. Outline the behavior of the following sets of keys after they have been configured correctly
Draft paper highlighting the nonfunctional requirements : draft paper highlighting the nonfunctional requirements and the steps to achieve these requirements. The draft should have some rationalization steps in how technologies are chosen.
Determine the type of muscle tissues : The image below shows a longitudinal view of a type of muscle.  Note the multiple nuclei that lie at the periphery of the muscle fibers as well as the striations (thin lines) formed by the arrangement of the thick and thin myofilaments.
What does he mean by internalize society values : What does he mean by "internalize society's values"? List activities that can assist you in "internalizing the values"

Reviews

Write a Review

 

Basic Computer Science Questions & Answers

  Write a unit test of minmax in a main function

Write a function that computes the minimum and maximum of two integer variables and returns them through call-by-refernce parameters. It should have the following prototype: int minmax(int a, int b, int * min, int * max); Write a unit test of minm..

  Create an application that generates a quiz

Create an application that generates a quiz. Prompt for the user's first and last name, college major, and confidence in test taking (high, medium, or low). The quiz should contain at least five true/false questions about horticulture.

  Critique the idea which the cio can be a bridge between

critique the idea that the cio can be a bridge between enterprise finance marketing and sales functions. justify the

  Implement the backend for a list

Using an array to implement the backend for a list, create a list class that can contain integers and implements all of the following funtionality via the following functions:List() - the constructor List (const List& 1) - a copy constructor

  Write a program that computes the total amount of money

Write a program that computes the total amount of money in dollars and cents when the number of pennies (1 cent), nickels (5 cents), dimes (10 cents) and quarters (25 cents) are given. Sample execution of the program is given below.

  Write a c++ program to calculate closet points from a list

Write a C++ program to calculate the closet points from a list. Output will be the name of 2 points Your input format will be : name x-value y-value The following is the input to test your program. A 10 50 B 30 70 C 20 40 D 40 10 E 30 20 F 20 50..

  Creating and commercializing a new technology

There are a number of factors and precautions that need to be considered when developing and introducing new technologies to the marketplace. This is especially the case when this could be a technology without a known history. One specific considerat..

  Write a program to support children spelling game hangman

The traditional way to play hangman is to draw a figure on a gallows. Another part of the hanged man is added for each incorrect guess.

  Write a program that prompts the user for an integer value

write a program that prompts the user for an integer value for a length of a youtube clip in seconds then display the number of hours

  Structured analysis and object-oriented techniques

A frequently asked question is "Can structured techniques and object-oriented techniques be mixed?

  Develop a program that will allow the district sales manager

You have been asked to develop a program that will allow the district sales manager to input each of the dealership's ID along with their four quarterly sales volumes for the year, calculate and display each quarter's rebate and the sales bonus fo..

  Start by identifying all the hazards and potential causes

Start by identifying all the hazards and potential causes of harm to the IT infrastructure and functionality (for example, what are you going to do if the VIU main web site goes down, or what happens if viruses get into VIU computer systems, or..

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