Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

*Please write out the queries that would be entered into a SQL Server* Complete the queries listed below in SQL Server. Use AdventureWorks2014 database to

*Please write out the queries that would be entered into a SQL Server*

Complete the queries listed below in SQL Server. Use AdventureWorks2014 database to work on the assignment. When creating a new query, dont forget to run (execute) the following statement first so set the current database:

use AdventureWorks2014;

Save your work as queries2.sql and submit the file in D2L. Do not submit any other files. I will use the submitted file to run your code.

4.1. Write a SQL statement to retrieve the product ID and name from Production.Product table, returning only products with reorder point (ReorderPoint) of 600.

4.2. Write a SQL statement to retrieve the product ID and name from Production.Product table, returning only those products with a reorder point of 100 or less.

4.3. Write a SQL statement that retrieves the unique list order IDs (SalesOrderID) from Sales.SalesOrderDetail table, which contain 30 or more of any item (OrderQty). Sort the output by the number of items.

4.4. Write a SQL statement that retrieves product ID (ProductID) and price (UnitPrice) from Sales.SalesOrderDetail for all products priced between 50 and 100. Sort the results by price.

5.1. Write a SQL statement to retrieve the vendor name (Name) from the Purchasing.vVendorWithAddresses view, returning only vendors located in Everett (City) in Washington (StateProvinceName).

5.2. Write a SQL statement to retrieve all orders (SalesOrderID) from Sales.SalesOrderDetail where at least 30 of products 863, 867, 869 were ordered. Use the IN operator

5.3. Rewrite 5.2 and use OR instead of IN. Make sure the output is the same as 5.2

5.4. What is wrong with the following statement?

select *

from Person.Person

order by LastName

where PersonType = 'EM' and FirstName = 'David'

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Practical Database Programming With Visual Basic.NET

Authors: Ying Bai

1st Edition

0521712351, 978-0521712354

More Books

Students also viewed these Databases questions