Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Help with PostgreSQL!! Here is what I have so far: Lab Questions Expand 1. Write an SQL Script to create a new table to hold

Help with PostgreSQL!!

image text in transcribed

Here is what I have so far:

image text in transcribed

Lab Questions Expand 1. Write an SQL Script to create a new table to hold information on the competing universities. The table should hold the following information: University Name (Text) Date Established (Date) Address Student Population (Int) Acceptance Rate (Decimal) (Address) 2. Write an insert statement to add the following University Information The table should hold the following information: University Name CU Boulder Date Established 1876 Address Student Population 35,000 Acceptance Rate 80% 1100 28th St, Boulder, CO 80303 3. Write a script to list the Football Players (name & major), organized by major in college 4. Write a script to list all of the Football Players (name & rushing yards) who have 70 or more rushing yards. 5. Write a script to list all of the games played against Nebraska (show al game information). 6. Write a script to list all of the games CU Boulder has won. 7. Write a script to list all of the games played in the Fall 2018 Season (show team name &game date). 8. Write a script to create a view that counts the total number of winning games. 9. Write a script to create a view that counts the total number of games played. 10. Write a script that uses the two views you created (from 8 & 9) to calculate the percent of wins. 11. Write a script that will count how many games "Cedric Vega" has played in during his entire football career Don't worry about handling multiple Cedric Vegas, you can assume there is only1 football player named Cedric Vega. This should to simplify your query 12. Write a script that will calculate the average number of rushing yards for "Cedric Vega", based on the number of games he has played. Don't worry about handling multiple Cedric Vegas, you can assume there is only 1 football player named Cedric Vega. This should to simplify your uer CREATE TABLE IE NOT EXISTS football _ganes visitor nane VARCHAR (30), hatte score SMALLINT NOT NULL, /* inal score of the game for the Buffs visito.-score SMALLINI KOT NULL, /* inal score of the game for the visiting team */ gane date DATE OI NULL, player INI NOI NULL, ERINARY KEr (viaitor name, gane date) A gane'a unique primary key conaiate of the viaitor_namethe game date (thia aes you can' hav ltiple gamea againat the ame team in a aingle day) Name of the visiting tesm Date of the gane Thia array coneiete of the ootbaii player 1ds (ba3ically a foreign key to the football player.id) CREATE TABLE IE NOT EXISTS football player id SERIAL PRIMARY KEY name VARCHAR50) Nor NULL, year VARCHAR (3) /. Unique identifier for each player (1t'5 po551ble multiple pleyer5 have the 5ame name/51m118r formation) */ /* The player' frst last name */ SH Ereshman, SPE -Sphcmore, NR Junio, R - Senior/ /* The unique 4 character code used by CU Boulder to identify student majoce (ex. CSCI, ATLS) passing yards sMALLINI rushing_yarde MALLINT The nuber of passing yard in the players entie cotbali caree */ The number of rushing yads in the players entie cotbaii career / The number of receiving yards in the players entire footbal1 career win varda SMALLINT, img_arc VARCHAR (200) /+ Th1B 1B a file path (abaolute or relative), tat locatea the player's profile image CREATE TABLE IE NOT EXISTS football opponents( school_nane VARCHAR (30) NOT NULL, date established INT NOT NULL, Name of the visiting tes Date of the game VARCHAR(50). student_Pop BIGINT acceptance rate INERIC PRIMARY KEY{Bch001 name) /, A gane'e unique primary key coneista of the visitor name the gane date rnie aeeumea you can't have multiple ganes against the eame tean in a aingle day) INSERT INTO football_games (isitor name, home score, v11t0 acore game date, players) VALUES['Colorado State' 45, 13, "20180B3ARRAY [,2,3,4,51) 'Nebraska', 33, 28 '20180908,ARRAY [2,3.4,5,61), "New Harpshire, 45, 14, 20180915,ARRAY 13,4,S,6,7]), UCLA 38, 16, 20180929, ARRAY [4, 5, ,7,]) 'Arizons State', 22, 21, '201e00ARRAY 5, 8,7,8, 91) 'Southern California', 20, 3, 20181013', BBAY [6,7,e,9,101) ashingten, 13, 27. '20181020,ARRA [7,,,10,11), ('Oregon State,34, 41, 20181027,ARRAY [e, 9,10,1,21) ('Arizona, 34, 42, '20181102, ARRAY [9,10,1,2,31), ('Haahington Scate'7, 31 "20181110, ARRAY [10,1,2,3, 41) 'Utah, 7, 30 20181117, ARRAY [1,2,3,4,5]), 'California',21, 33, '20181124,ARRAY [2,3,4,5,61) INSERT IO footbl1_playesnae, yea,major, passing yards, rushing yards, xeceiving yerds) VALUES ("Cedric Vega''ESH',"ARTS15, 25, 33) (Myron WalterE"C3CI, 32, 43, 52), (Javier Washingten,JR, IH, 1, 61, 45), "ade aer,NR.'RIS,14, 55, 12) Doyie Hufr, 'ESH,CSCI 23, 44, 92) ('Melba Fope,SPH','VATH,13, 22, 45), Erick Gravea,UNR'ARTS",45, 78, 9 'Charies ForcerSNRCSCT,92, 102, 125), 'Rafsel Boreous JNB''MATH',102, 111, 105), 'Jared CastilloSNR'ARTS',112, 113, 114) INSERT INTO football-opponents! school-name, date-established, address, student-pop, VALUES["CU Bouler',1976, 1100 28h 3,Eoulder, co80303,35000, 0) acceptance-rate)

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

Data Analytics Systems Engineering Cybersecurity Project Management

Authors: Christopher Greco

1st Edition

168392648X, 978-1683926481

More Books

Students also viewed these Databases questions