Web Development Exercise 7-1

Feb 21st, 2015
RockCafe
Category:
Computer Science
Price: $5 USD

Question description

In this project, 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 file named team_stats.txt in your Projects
         1.   Log in to MySQL Monitor with your root account or with the

                                            user name and password supplied by your ISP or instructor.
         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 col-                   439
        umns use INT data types, and the remaining two fields use
        FLOAT data types. Each of the statistical field names uses com-
        mon baseball abbreviations, such as G for games, AB for at-
        bats, 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 file in your Projects directory for Chapter 7
                                                                         Use the
        into the teamstats table. Replace path_to_PHP_folders with
                                                                         MySQL serv-
        the full path for your PHP_Projects directory for Chapter 7.     er’s direc-
        mysql> LOAD DATA INFILE 'path_to_PHP_folders/                    tory path,
        Chapter.07/Projects/team_stats.txt'[ENTER ]                      not the Web
            -> INTO TABLE teamstats;[ENTER ]                             URL path.

   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 ]
       

Tutor Answer

(Top Tutor) Daniel C.
(997)
School: UC Berkeley
PREMIUM TUTOR

Studypool has helped 1,244,100 students

3 Reviews


Summary
Quality
Communication
On Time
Value
BlueOcean
Nov 11th, 2016
" Awesome! Exactly what I wanted. "
ashleyisgod
Oct 19th, 2016
" Top quality work from this guy! I'll be back! "
Molly_Moon
Sep 27th, 2016
" AMAZING as always! "
Ask your homework questions. Receive quality answers!

Type your question here (or upload an image)

1829 tutors are online

Brown University





1271 Tutors

California Institute of Technology




2131 Tutors

Carnegie Mellon University




982 Tutors

Columbia University





1256 Tutors

Dartmouth University





2113 Tutors

Emory University





2279 Tutors

Harvard University





599 Tutors

Massachusetts Institute of Technology



2319 Tutors

New York University





1645 Tutors

Notre Dam University





1911 Tutors

Oklahoma University





2122 Tutors

Pennsylvania State University





932 Tutors

Princeton University





1211 Tutors

Stanford University





983 Tutors

University of California





1282 Tutors

Oxford University





123 Tutors

Yale University





2325 Tutors