In this assignment you will write an SQL script that will create a database with five...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
In this assignment you will write an SQL script that will create a database with five tables. In addition, you will use insert statements to add some initial records to the tables. For reference, use database scripts from the course site, Chapters 6 and 7 of your textbook, MySQL help menu, powerpoints from class, and online documentation. Note: some of the syntax in the slides may not work in MySQL, so double check the documentation as you go. Your solution should be in text file named using your last name followed by your first initial followed by 01, with txt extension: SmithJ01.txt for example. Be certain to include the following two lines at the top of your SQL assignment file. -- SQL Assignment 01 Your first and last name Important: You should test your script periodically by running the source command (don't forget to save it first). Make sure it is running properly before submission. Instructions You have been chosen to create a database for the NFL (National Football League). You will be constructing five tables and loading a small amount of records into each of them. Your SQL statements will involve DDL (Data Definition Language) syntax, including data types, domain constraints, primary and foreign key designations, among others. Here are the relations you will use as input to build your tables: TEAM(teamID, name, city, state) COACH(first, last, yearsExperience, current Team) FK: currentTeam -> TEAM PLAYER(number, team, first, last, hometown, position) FK: team -> TEAM GAME(team1, team2, dateOfGame, winner) FK: team1> TEAM team2 -> TEAM FRANCHISEHOLDER(franchiseHolderID, team, number) FK: team -> TEAM number, team -> PLAYER Here is some additional information regarding each table: . TEAM 1. "teamID" is an integer and should be automatically incremented each time a new record is inserted automatically. . . 2. "name" and "city" should be varying-size strings. 3. "state" will always be an abbreviation like "MO" or "CA". 4. The nfl will like to keep the "name" of the team unique- no copycats, no matter how jealous other teams may be! COACH 1. "first" and "last" names should be varying-size strings. 2. "yearsExperience" should be an integer, at least zero, but no higher than 55. You will have to find out how to add a domain constraint to a column (Hint: check...). ▪ Note: Your domain constraint my not actually be enforced in the current version of MySQL, but that's fine, we just want to see that you can use the proper syntax. PLAYER 1. "number" is an integer. 2. "first", "last", "position", and "hometown" should be varying-size strings. "first" and "last" should never be empty. GAME 1. "team1" and "team2" are integers. 2. "dateOfGame" is of datetime type and has a default value of current_timestamp. 3. "winner" is an integer and should never be empty. FRANCHISEHOLDER 1. "franchiseHolderID" is an integer and should automatically increment. 2. "team" is an integer and should never be empty. "team" should always be unique, i.e. teams can only have one franchise player. 3. "number" is an integer and should never be empty. Inserting Records 1. Add 3 records to TEAM. Only include values for "name", "city", and "state" ("teamid" will start at 1 and automatically increment). 2. Add 3 records to PLAYER, one from each team. 3. Add 3 records to COACH, one for each team. 4. Add at least I record to GAME. The winner is up to you. 5. Add 3 records to FRANCHISEHOLDER, one for each team. In this assignment you will write an SQL script that will create a database with five tables. In addition, you will use insert statements to add some initial records to the tables. For reference, use database scripts from the course site, Chapters 6 and 7 of your textbook, MySQL help menu, powerpoints from class, and online documentation. Note: some of the syntax in the slides may not work in MySQL, so double check the documentation as you go. Your solution should be in text file named using your last name followed by your first initial followed by 01, with txt extension: SmithJ01.txt for example. Be certain to include the following two lines at the top of your SQL assignment file. -- SQL Assignment 01 Your first and last name Important: You should test your script periodically by running the source command (don't forget to save it first). Make sure it is running properly before submission. Instructions You have been chosen to create a database for the NFL (National Football League). You will be constructing five tables and loading a small amount of records into each of them. Your SQL statements will involve DDL (Data Definition Language) syntax, including data types, domain constraints, primary and foreign key designations, among others. Here are the relations you will use as input to build your tables: TEAM(teamID, name, city, state) COACH(first, last, yearsExperience, current Team) FK: currentTeam -> TEAM PLAYER(number, team, first, last, hometown, position) FK: team -> TEAM GAME(team1, team2, dateOfGame, winner) FK: team1> TEAM team2 -> TEAM FRANCHISEHOLDER(franchiseHolderID, team, number) FK: team -> TEAM number, team -> PLAYER Here is some additional information regarding each table: . TEAM 1. "teamID" is an integer and should be automatically incremented each time a new record is inserted automatically. . . 2. "name" and "city" should be varying-size strings. 3. "state" will always be an abbreviation like "MO" or "CA". 4. The nfl will like to keep the "name" of the team unique- no copycats, no matter how jealous other teams may be! COACH 1. "first" and "last" names should be varying-size strings. 2. "yearsExperience" should be an integer, at least zero, but no higher than 55. You will have to find out how to add a domain constraint to a column (Hint: check...). ▪ Note: Your domain constraint my not actually be enforced in the current version of MySQL, but that's fine, we just want to see that you can use the proper syntax. PLAYER 1. "number" is an integer. 2. "first", "last", "position", and "hometown" should be varying-size strings. "first" and "last" should never be empty. GAME 1. "team1" and "team2" are integers. 2. "dateOfGame" is of datetime type and has a default value of current_timestamp. 3. "winner" is an integer and should never be empty. FRANCHISEHOLDER 1. "franchiseHolderID" is an integer and should automatically increment. 2. "team" is an integer and should never be empty. "team" should always be unique, i.e. teams can only have one franchise player. 3. "number" is an integer and should never be empty. Inserting Records 1. Add 3 records to TEAM. Only include values for "name", "city", and "state" ("teamid" will start at 1 and automatically increment). 2. Add 3 records to PLAYER, one from each team. 3. Add 3 records to COACH, one for each team. 4. Add at least I record to GAME. The winner is up to you. 5. Add 3 records to FRANCHISEHOLDER, one for each team.
Expert Answer:
Answer rating: 100% (QA)
Answer I Copy the below code in a text document that is needed to submit CODE SQL Assignment 1 YourName create database CREATE DATABASE NFL activate d... View the full answer
Related Book For
Modern Database Management
ISBN: 978-0133544619
12th edition
Authors: Jeff Hoffer, Ramesh Venkataraman, Heikki Topi
Posted Date:
Students also viewed these accounting questions
-
Introduction In this assignment you will write a small C program to read the coefficients of a third degree equation, and use a numerical integration method for calculating a numerical value of a...
-
You will write an 8- 10 page research paper on one of the "Six Debates Over Macroeconomic Policy DO NOT ATTEMPT IF YOU ARE NOT WILLING TO WRITE A 8-10 PAGE RESEARCH PAPER INCLUDING ALL REFERENCES...
-
For this assignment you will write a paper relating a topic in physical science to your career field or other real-world practical application. You must use at least three different sources, and cite...
-
Lionel Train Company has the following information for this year and next year. Current Next Year Year Trains purchased 40,000 48,000 Trains scrapped in production 4,000 3,000 Trains sold 36,000...
-
Do you see any limitations to the viability and growth of Harley in the future? Discuss how these might be countered.
-
There are four entrances to the Government Center Building in downtown Philadelphia. The building maintenance supervisor would like to know if the entrances are equally utilized. To investigate, 400...
-
In this exercise, we explore what happens when an item is marked up by a percentage, and then marked down using the same percentage. Wegmans purchases an item for \(\$ 5\) per unit. The markup on the...
-
In problem 89 of Chapter 9, you were asked to determine the initial basis of Emelio and Charitas business, investment, and personal use assets. In this problem, you are to determine the adjusted...
-
Please assist with the below questions: 1. Investment Timing Option: Decision-Tree Analysis Kim Hotels is interested in developing a new hotel in Seoul. The company estimates that the hotel would...
-
Kinshasa Camera Shop uses the lower-of-cost-or-market basis for its inventory. The following data are available at December 31. Instructions Determine the amount of the ending inventory by applying...
-
Instructions: Find and provide a complete, full-form citation to the cases requested in each question. You may also be asked to find information about that case or related cases, using the West...
-
The Prince Albert Corporation has forecast the following salesfor the first seven months of the year. January $11,000 May 11,000 February 13,000 June 17,000 March 15,000 July 19,000 April 21,000...
-
A company is negotiating wages with its union. The firm's profits are E = 10 where is the salary. The objective function of the union union is U = 10 (^2) 5. The rules of wage bargaining are as...
-
In this essay, you will explore the communication process, the various types of communication, barriers to effective communication, and their importance to the criminal justice field. You are your...
-
Explain organizational behavior and its importance. Explain the four main functions of management. Describe the three roles of management. Describe the three skills of management. Explain the three...
-
There are factors inside of a country that impacts HRM, as well as factors outside of a country that can impact HRM. For example, the laws of one country, in terms of labor union membership, can...
-
Exercise 5-8 (Algo) Equivalent Units; Cost per Equivalent Unit; Assigning Costs to Units-Weighted- Average Method [LO5-2, LO5-3, LO5-4] Helix Corporation uses the weighted-average method in its...
-
Select a mass spectrometric technique with the highest mass resolution for identifying an unknown compound being eluted from a liquid chromatography column
-
Review Figure 11-6 and answer the following questions based on it. a. What has happened between Input and Input'? b. Assume that the values associated with each of the keys (kl, k2, etc.) are counts....
-
What is the average length of time a student stayed (or has stayed) in the program?
-
Create a strategy for reviewing your database implementation with the appropriate stakeholders . Which stakeholders should you meet with? What information would you bring to this meeting? Who do you...
-
What costs are associated with buying a home?
-
What activities are associated with selling a home?
-
State three reasons you should carefully inspect the property you plan to purchase.
Study smarter with the SolutionInn App