Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Create SELECT statements to produce the described data. All columns must have meaningful column headers. Turn in all SQL statement(s) needed to solve the problem

Create SELECT statements to produce the described data. All columns must have meaningful column headers. Turn in all SQL statement(s) needed to solve the problem not the data itself. Paste your answers below the problem in red and turn in only this answer page. I HIGHLY recommend you make sure you have answered all aspects of a problem before submission. I also suggest you create views to simplify your work. Do this assignment from your college DB. I if you use views, I will look them over. I also will expect you to be able to decide which tables to join/use (know your data). If you have not already, copy the data into your database. You cannot create views outside your database. Use the BaseBall data. Also, make sure you run your statements before you turn them in. If you need assistance, see me. (3 points each)

1. Total lifetime batting history (all batting table data) for all players returned in player name order (hint: simple SELECT * from view).

2. Display hall of fame homerun hitters, those that hit 500 or more home runs in their career. Include their playerID, name, and number of home runs. Because there might be duplicate names, group by playerID and name.

3. How many and which players have the same first and last names? For example: Dave Jones 5 You will need only the Players table. Exclude unique names include only those with 2 or more matches (Having)

4. The average players weight and height by teams during the year 1987. Team Avg Weight Avg Height

5. What are the top 5 Teams with the greatest average weight (display the team and weight)? TOP is acceptable here.

6. Display the average weight and height of the Mariners (SEA) for each year they played. Include the year, average weight, and average height in year order starting with the most recent year.

7. Compare (list) the total home runs hit by year for all teams in year order Year Total Homeruns

8. Which (if any) current batters (final game date game after 1/1/1990 and not deceased) weigh less than 180 pounds and hit 100 or more home runs in their career. Return the name and number of home runs ordered by the most home runs to the least. Include the PlayerID to allow for different players with the same name.

Extra Credit (2 points) Alter the previous problem to include players weighing the same or less than the average weight or all players throughout history. Do not hardcode the average weight I expect a single

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

Transact SQL Cookbook Help For Database Programmers

Authors: Ales Spetic, Jonathan Gennick

1st Edition

1565927567, 978-1565927568

More Books

Students also viewed these Databases questions