Loading Data Into A Table - Oracle 5.0 Reference Manual

Table of Contents

Advertisement

Several types of values can be chosen to represent sex in animal records, such as
perhaps
'male'
The use of the
Once you have created a table,
mysql>
SHOW TABLES;
+---------------------+
| Tables in menagerie |
+---------------------+
| pet
+---------------------+
To verify that your table was created the way you expected, use a
mysql>
DESCRIBE pet;
+---------+-------------+------+-----+---------+-------+
| Field
| Type
+---------+-------------+------+-----+---------+-------+
| name
| varchar(20) | YES
| owner
| varchar(20) | YES
| species | varchar(20) | YES
| sex
| char(1)
| birth
| date
| death
| date
+---------+-------------+------+-----+---------+-------+
You can use
what types they have.
For more information about MySQL data types, see

3.3.3. Loading Data into a Table

After creating your table, you need to populate it. The
for this.
Suppose that your pet records can be described as shown here. (Observe that MySQL expects dates
in
'YYYY-MM-DD'
name
Fluffy
Claws
Buffy
Fang
Bowser
Chirpy
Whistler
Slim
Because you are beginning with an empty table, an easy way to populate it is to create a text file
containing a row for each of your animals, then load the contents of the file into the table with a single
statement.

Loading Data into a Table

Note
Prior to MySQL 5.0.3, the upper limit was 255.) If you make a poor choice and it
turns out later that you need a longer field, MySQL provides an
statement.
and 'female'. It is simplest to use the single characters
data type for the
DATE
SHOW TABLES
|
| Null | Key | Default | Extra |
|
|
|
| YES
|
| YES
|
| YES
|
any time, for example, if you forget the names of the columns in your table or
DESCRIBE
format; this may be different from what you are used to.)
owner
species
Harold
cat
Gwen
cat
Harold
dog
Benny
dog
Diane
dog
Gwen
bird
Gwen
bird
Benny
snake
and
columns is a fairly obvious choice.
birth
death
should produce some output:
| NULL
|
|
| NULL
|
|
| NULL
|
|
| NULL
|
|
| NULL
|
|
| NULL
|
|
Chapter 11, Data
LOAD DATA
sex
birth
f
1993-02-04
m
1994-03-17
f
1989-05-13
m
1990-08-27
m
1979-08-31
f
1998-09-11
1997-12-09
m
1996-04-29
200
ALTER TABLE
and 'f', or
'm'
and 'f'.
'm'
statement:
DESCRIBE
Types.
and
statements are useful
INSERT
death
1995-07-29

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the 5.0 and is the answer not in the manual?

Questions and answers

This manual is also suitable for:

Mysql 5.0

Table of Contents