Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Your task in this project is to write the following queries in SQL and make sure they run in the PostgreSQL database. If you make

Your task in this project is to write the following queries in SQL and make sure they run in the PostgreSQL database. If you make any assumptions, clearly state them as comments in your submitted file.

3. Find those who happened to be a coach and a player in the same team in the same season. List their first names, last names, the team where this happened, and the year(s) when this happened.

3. Find those who happened to be a coach and a player in the same team in the same season. List their first names, last names, the team where this happened, and the year(s) when this happened. 4. Find the average height (in centimeters) of each team coached by Phil Jackson in each season. Print the team name, season and the average height value (in centimeters), and sort the results by the average height. 5. Find the coach(es) (first name and last name) who have coached the largest number of players in year 1999. 6. Find the coaches who coached in ALL leagues. List their first names followed by their last names. 7. Find those who happened to be a coach and a player in the same season, but in different teams. List their first names, last names, the season and the teams this happened.

Schema

create table teams (tid varchar(30), location varchar(30), name varchar(30),league varchar(30), primary key (tid, league)); create table coaches_season (cid varchar(30), year int, yr_order int,firstname varchar(30), lastname varchar(30), season_win int, season_loss int,playoff_win int, playoff_loss int, tid varchar(30), primary key (cid, year,yr_order)); create table draft (draft_year int, draft_round int, selection int, tidvarchar(30), firstname varchar(30), lastname varchar(30), ilkid varchar(30),draft_from varchar(100), league varchar(30)); create table players (ilkid varchar(30), firstname varchar(30), lastnamevarchar(30), position varchar(1), first_season int, last_season int, h_feet int,h_inches real, weight real, college varchar(100), birthday varchar(30), primarykey (ilkid)); create table player_rs_career (ilkid varchar(30), firstname varchar(30),lastname varchar(30), league varchar(10), gp int, minutes int, pts int, drebint, oreb int, reb int, asts int, stl int, blk int, turnover int, pf int, fgaint, fgm int, fta int, ftm int, tpa int, tpm int); create table player_rs (ilkid varchar(30), year int, firstname varchar(30),lastname varchar(30), tid varchar(30), league varchar(10), gp int, minutes int,pts int, dreb int, oreb int, reb int, asts int, stl int, blk int, turnover int,pf int, fga int, fgm int, fta int, ftm int, tpa int, tpm int, primary key(ilkid,year, tid));

coaches_season, each tuple of which describes the performance of one coach in one season;

teams, each tuple of which gives the basic information of a team;

players, each tuple of which gives the basic information of one player;

player_rs, each tuple of which gives the detailed performance of one player in one regular season;

player_rs_career, each tuple of which gives the detailed regular-season performance of one player in his career;

draft, each tuple of which shows the information of an NBA draft.

Answer in psql please thanks

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

Advances In Databases And Information Systems 22nd European Conference Adbis 2018 Budapest Hungary September 2 5 2018 Proceedings Lncs 11019

Authors: Andras Benczur ,Bernhard Thalheim ,Tomas Horvath

1st Edition

3319983970, 978-3319983974

More Books

Students also viewed these Databases questions

Question

=+such as the dirigenti in Italy?

Answered: 1 week ago

Question

=+ Are there closed-shop requirements or practices?

Answered: 1 week ago