Question
write this in PSQL , 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),
write this in PSQL ,
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));
1. Write a function named player_height_rank that, given the first name and last name of a player, returns the rank of that player based on his height. Note that the players table stores height information in feet and inches, thus you have to sort the players by total height instead of h_feet or h_inches to get the rank. For a player, his rank is defined as one plus the number of players taller than he is. Note that players with the exact same height should have the same rank. Some examples according to the NBA database are: Gheorghe Muresan ranked 1 with a height of 7 feet and 7 inches; Manute Bol ranked 2nd (7 ft. 6 in.); Ming Yao and three others ranked 3rd (7 ft. 5 in.); and five other players with height 7 ft. 4 in. all ranked 7th, etc. If the name given does not match any player in the players table, the function returns 0.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started