Purchase Solution

SQL Sample Database Queries

Not what you're looking for?

Ask Custom Question

I am seeking help with solving several SQL statements. I am specifically looking for the code that goes with these problems.

6) A wide world importers company tracks its order information in a database that includes two tables: Order and LineItem. See table structures below:

CREATE TABLE dbo.Order (
OrderID int NOT NULL,
CustomerID int NOT NULL,
OrderDate datetime NOT NULL,
CONSTRAINT DF_Order_OrderDate DEFAULT (getdate())FOR OrderDate,
CONSTRAINT PK_Order PRIMARY KEY CLUSTERED (OrderID)
)
CREATE TABLE dbo.LineITEM (
ItemID int NOT NULL,
OrderID INT NOT NULL,
ProductID int NOT NULL,
Price money NOT NULL,
CONSTRAINT PK_LineITEM PRIMARY KEY CLUSTERED (ItemID),
CONSTRAINT FK_LineITEM_Order FOREIGN KEY (OrderID)
REFERENCES dbo.Order (OrderID)
)

The company's auditors have discovered that every item that was ordered on June 1, 2000, was entered with a price that was $10 more than its actual price. You need to correct the data in the database as quickly as possible.

7) A sporting goods company exports products to customers worldwide. The company stores its sales information in a database named sales. Customer names are stored in a table named Customer in this database.

CREATE TABLE customers (
CustmerID int NOT NULL,
CustomerName varchar(30) NOT NULL,
ContactName varchar(30) NULL,
Phone varchar(20) NULL,
Country varchar(30) NOT NULL,
CONSTRAINT PK_Customers PRIMARY KEY (CustomerID)
)

There are usually only one or two customers per country. However, some countries have as many as 20 customers. Your company's marketing department wants to target its advertising to countries that have more than 10 customers. You need to create a list of these countries for the marketing department.

****Feel free to input your own countries for this*****

Purchase this Solution

Solution Summary

A sample of database queries are provided. Order and Line items are determined.

Solution Preview

Attached.

6) A wide world importers company tracks its order information in a database that includes two tables: Order and LineItem. See table structures below:

CREATE TABLE dbo.Order (
OrderID int NOT NULL,
CustomerID int NOT NULL,
OrderDate datetime NOT NULL,
CONSTRAINT DF_Order_OrderDate DEFAULT (getdate())FOR OrderDate,
CONSTRAINT PK_Order PRIMARY KEY CLUSTERED (OrderID)
)
CREATE TABLE dbo.LineITEM (
ItemID int NOT NULL,
OrderID INT NOT ...

Purchase this Solution


Free BrainMass Quizzes
Basic Computer Terms

We use many basic terms like bit, pixel in our usual conversations about computers. Are we aware of what these mean? This little quiz is an attempt towards discovering that.

Word 2010: Table of Contents

Ever wondered where a Table of Contents in a Word document comes from? Maybe you need a refresher on the topic? This quiz will remind you of the keywords and options used when working with a T.O.C. in Word 2010.

Javscript Basics

Quiz on basics of javascript programming language.

Word 2010: Tables

Have you never worked with Tables in Word 2010? Maybe it has been a while since you have used a Table in Word and you need to brush up on your skills. Several keywords and popular options are discussed as you go through this quiz.

Basic UNIX commands

Use this quiz to check your knowledge of a few common UNIX commands. The quiz covers some of the most essential UNIX commands and their basic usage. If you can pass this quiz then you are clearly on your way to becoming an effective UNIX command line user.