Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

SQL query help. SQL DIAGRAM Step 2: In step 3, you will be writing three SQL queries- all of which create a table. Your entire

SQL query help. image text in transcribed
image text in transcribed
SQL DIAGRAM Step 2: In step 3, you will be writing three SQL queries- all of which create a table. Your entire code will be based off the rules listed below. It will combine everything we learned during the week regarding keys and constraints. It is important you read all of the following requirements before starting your code. 1. Create three tables based upon the following E/R diagram: players teams smallintPK smallint player id PK PK coach id irst name varchar(25) last name varchar 50 itle salary team id Int team id serial serial varchar(50) varchar(50) char(3) char(5) first name varchar(25) last name varchar(50)conference city name varchar(25) int division smallint int Int FK team id FK Ensure that the SQL to create the tables includes all key constraints required based upon the primary and foreign keys shown in the E/R diagram. 2. Ensure that if a row is deleted from the teams table, it is automatically deleted from both the players and teams tables, i.e. there is a cascade delete for both 3. 4. In the NFL, player numbers can only be the numbers 1 through 99. Create a CHECK constraint that ensures no number lower than 1 or higher than 99 can be entered into the 'number' column in the 'players' table There are two conferences in the NFL"NFC" and 'AFC'-create a CHECK constraint that ensures any data being entered into the 'conference' column in the 'teams' table has to be one of those two values 5 6. Create a UNIQUE constraint that ensures the 'name' attribute in the 'teams' table cannot have duplicate values. Ensure that each row entered into both the 'players' and'coaches' table must have first names and last names, i.e. first name and last name cannot be null for either table 7. Steps 3: Write three SQL queries based upon the requirements in step 2. You should have one query for the creation of each table; players, teams, and coaches. All constraints should be included within the table creation queries and no table alters should be used. Again, the three table creation queries should meet all of the requirements in step 2. If your code does not worlk you will receive 0 points

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

The Manga Guide To Databases

Authors: Mana Takahashi, Shoko Azuma, Co Ltd Trend

1st Edition

1593271905, 978-1593271909

More Books

Students also viewed these Databases questions

Question

Is the person willing to deal with the consequences?

Answered: 1 week ago