Create the following SQL Queries The database contains the following six tables:
ID: 3723759 • Letter: C
Question
Create the following SQL Queries
The database contains the following six tables:
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.
DBMS used is PostgreSQL
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.
8. Find the players who have scored more points than Michael Jordan did. Print out the first name, last name, and total number of points they scored.
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.
Explanation / Answer
Below are the two queries..
Hope this helps ..Thank You... :)
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.
Query: select firstname,lastname,season,team from coaches_season,player_rs where coaches_season.name=player_rs.name and coaches_season.team!=player_rs.team
8. Find the players who have scored more points than Michael Jordan did. Print out the first name, last name, and total number of points they scored.
Query: select firstname,lastname,points from player_rs_career where firstname!=Michel and lastname!=Jordan and player_rs_career.points>=(select points from player_rs_career where firstname=Michel and lastname=Jordan).
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.