Purchase Solution

Explicit SQL Statement

Not what you're looking for?

Ask Custom Question

Given the attached tables (see attachment):

1- Provide an explicit JOIN SQL statement that returns the store ID, store name, manager employee first and last name fields, manager employee grade, the city and state fields of the store. Only unique rows should be returned. Note that the 4th field in the Employee table is the employee grade field, the 2nd field in the Store table is the Store name, and the 3rd field in the Store table is the manager's ID. All ID fields are of a numeric type.

2- Write a query that returns the first name, last name, id, city and state fields from the Employee, User and Store tables. To return these fields from all three tables, UNION keywords must be applied. Note that the first name, last name and id are to be returned in one single alphabetical field, with a space separating first from last, and a dash character, '-', separating last from ID. For the Store table, the store name is returned, along with the store id, separated by a dash character.

3- Write a query that contains a subquery, which returns the store name, manager last name, city, state and country fields from the Store table. Hint: A JOIN should not be used; A subquery should be used instead.

Purchase this Solution

Solution Summary

The solution discusses the SQL statement.

Solution Preview

/*1- Provide an explicit JOIN SQL statement that returns the store ID, store name,
manager employee first and last name fields, manager employee grade, the city
and state fields of the store. Only unique rows should be returned.
Note that the 4th field in the Employee table is the employee grade field, the 2nd field in
the Store table is the Store name, and the 3rd field in the Store table is the manager's ID.
All ID fields are of a numeric type.*/

SELECT s.SoteId,s.StoredName,e.FirstName as [Employee First Name]
,e.LastName as ...

Purchase this Solution


Free BrainMass Quizzes
Basic Networking Questions

This quiz consists of some basic networking questions.

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.

Excel Introductory Quiz

This quiz tests your knowledge of basics of MS-Excel.

C# variables and classes

This quiz contains questions about C# classes and variables.

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.