Database Reference
In-Depth Information
who are interested in bird-watching. We'll call it
birdwatchers
and we'll create one
table for it that we'll call
humans
, to correlate with the name of
birds
table:
CREATE DATABASE
birdwatchers
;
CREATE TABLE
birdwatchers
.
humans
(
human_id
INT
AUTO_INCREMENT
PRIMARY KEY
,
formal_title
VARCHAR
(
25
),
name_first
VARCHAR
(
25
),
name_last
VARCHAR
(
25
),
email_address
VARCHAR
(
255
));
This isn't much of a table; we're not collecting much information on members, but it will
do well for now. Let's enter some data into this table. The following adds four people to
our table of members of the site:
INSERT INTO
birdwatchers
.
humans
(
name_first
,
name_last
,
email_address
)
VALUES
(
'Mr.'
,
'Russell'
,
'Dyer'
,
'russell@mysqlresources.com'
),
(
'Mr.'
,
'Richard'
,
'Stringer'
,
'richard@mysqlresources.com'
),
(
'Ms.'
,
'Rusty'
,
'Osborne'
,
'rusty@mysqlresources.com'
),
(
'Ms.'
,
'Lexi'
,
'Hollar'
,
'alexandra@mysqlresources.com'
);
This enters information for four humans. Notice that we left the first column NULL so
that MySQL can assign an identification number automatically and incrementally.
We've created some simple tables. We could do more, but this is enough for now to better
understand tables and theirstructure.