Question
In this exercise, you will create a database to contain tables of batting statistics for major league baseball teams. You will then create a table
In this exercise, you will create a database to contain tables of batting statistics for major league baseball teams. You will then create a table named teamstats in the baseball_stats database and add records to the new table from a fi le named team_stats.txt in your Projects directory for Chapter 7. 1. Log in to MySQL Monitor with your root account or with the user name and password you created. 2. Enter the following command to create a database named baseball_stats: mysql> CREATE DATABASE baseball_stats;[ENTER ] 3. After you see the Query OK message, enter the following command to select the baseball_stats database: mysql> USE baseball_stats;[ENTER ] 4. After you see the Database changed message, type the following command to ensure that you selected the baseball_stats database: mysql> SELECT DATABASE();[ENTER ] 5. Enter the following command to create the teamstats table. The Team field uses the VARCHAR data type. Eleven of the columns use INT data types, and the remaining two fields use FLOAT data types. Each of the statistical fi eld names uses common baseball abbreviations, such as G for games, AB for atbats, R for runs, and HR for home runs. mysql> CREATE TABLE teamstats (Team VARCHAR(50), FirstYear INT,[ENTER ] G INT, W INT, L INT, Pennants INT, WS INT,[ENTER ] R INT, AB INT, H INT, HR INT, AVG FLOAT,[ENTER ] RA INT, ERA FLOAT);[ENTER ] 6. After you see the Query OK message, enter the following command to display the structure of the new table: mysql> DESCRIBE teamstats;[ENTER ] 7. Enter a LOAD DATA statement that inserts records from the team_stats.txt fi le in your Projects directory for Chapter 7 into the teamstats table. Replace path_to_PHP_folders with the full path for your PHP_Projects directory for Chapter 7. mysql> LOAD DATA INFILE 'path_to_PHP_folders/ Chapter.07/Projects/team_stats.txt'[ENTER ] INTO TABLE teamstats;[ENTER ] 8. After you see the Query OK message, enter the following command to view all the records in the teamstats table: mysql> SELECT * FROM teamstats;[ENTER ] 9. Take a screenshot of the records in the teamstats table and save it as a YourName_TeamStats.JPG 10. Upload the screenshot to the assignment dropbox in Blackboard
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