Database Reference
In-Depth Information
Copy the results of the second statement, the CREATE TABLE statement it re-
turns. Paste that into a text editor. Then use the DROP TABLE statement to delete
the table birds_wing_shapes in mysql .
In your text editor, change a few things in the CREATE TABLE statement you
copied. First, change the storage engine — the value of ENGINE for the table —
to a MyISAM table, if it's not already. Next, change the character set and colla-
tion for the table. Set the character set to utf8 and the collation to ut-
f8_general_ci .
Now copy the CREATE TABLE statement you modified in your text editor and
paste it into the mysql monitor and press [Enter] to run it. If you get an error,
look at the confusing error message and then look at the SQL statement in your
text editor. Look where you made changes and see if you have any mistakes.
Make sure you have keywords and values in the correct places and there are no
typos. Fix any mistakes you find and try running the statement again. Keep trying
to fix it until you're successful. Once you're successful, run the DESCRIBE state-
ment for the table to see how it looks.
4. Create two more tables, similar to birds_wing_shapes . One table will store
information on the common shapes of bird bodies, and the other will store in-
formation on the shapes of their bills. They will also be used for helping bird-
watchers to identify birds. Call these two tables birds_body_shapes and
birds_bill_shapes .
For the birds_body_shapes table, name the first column body_id , set the
data type to CHAR(3) , and make it a UNIQUE key column. Name the second
column body_shape with CHAR(25) , and the third column body_example ,
making it a BLOB column for storing images of the bird shapes.
For the birds_bill_shapes table, create three similar columns: bill_id
with CHAR(2) and UNIQUE ; bill_shape with CHAR(25) ; and
bill_example , making it a BLOB column for storing images of the bird
shapes. Create both tables with the ENGINE set to a MyISAM, the DEFAULT
CHARSET, utf8 , and the COLLATE as utf8_general_ci . Run the SHOW
CREATE TABLE statement for each table when you're finished to check your
work.
Search WWH ::




Custom Search