Microsoft Word - Sam's Teach Yourself MySQL in 21 Days - SAMS.doc

(singke) #1

  1. Add a couple of users to the database, and try using these accounts.
    The easiest way to add users is to use the GRANT statement. This can be accomplished
    by issuing the following commands:


GRANT ALL ON . TO mark@% IDENTIFIED BY "thor2000";


Day 5



  1. Describe some benefits of normalization.


Normalization helps create a flexible, efficient database that lends itself to easy reporting
and manipulating.


  1. Identify areas that may not need to be normalized.


Items such as two columns to hold addresses or zip codes may not need to be
normalized. Also, if you are going to capture a small amount of data, maybe one table
would be more efficient.

Day 5



  1. Describe some benefits of normalization.


Normalization helps create a flexible, efficient database that lends itself to easy reporting
and manipulating.


  1. Identify areas that may not need to be normalized.


Items such as two columns to hold addresses or zip codes may not need to be
normalized. Also, if you are going to capture a small amount of data, maybe one table
would be more efficient.

Day 7



  1. Using the knowledge you have gained here, go back and redefine all the column
    values of the Meet-A-Geek project.


See exercise 1 of the previous day.


  1. Practice inserting rows into a table using the SET and ENUM column types.


The following are a few examples:
INSERT INTO Customers (Smoker) VALUES('Y');
INSERT INTO Customers (Smoker) VALUES(NULL);
The first example will insert a Y into the table. The second example will insert the default
value, which, in your database, is N

Day 8



  1. Use the mysqlimport command, with the proper options, to complete the following
    task:


You need to import a spreadsheet from the shipping department. The shipping
department gives you a worksheet to import into the database that keeps track of all the
orders that have been shipped. The fields are separated by forward slashes and the data
is enclosed by single quotes. Everything that is on the sheet is new data; no old data has
been updated. Import the file.

To accomplish this, use the following command:
bin/mysqlimport –p -i –fields-enclosed-by=' –fields terminated-by=/


  1. Use the mysqldump command properly in the following scenario:


The boss wants to give a report to the accountants based on the Orders table. The
accountants need the quantity and price of every item that was ordered to figure out
commissions. They do not need the DDL, but they do need the report to be comma-
delimited. Create the report.

To accomplish this, use the following command:
Free download pdf