Retrieving Information From A Table - Oracle 5.0 Reference Manual

Table of Contents

Advertisement

You could create a text file
and given in the order in which the columns were listed in the
values (such as unknown sexes or death dates for animals that are still living), you can use
values. To represent these in your text file, use
Whistler the bird would look like this (where the whitespace between values is a single tab character):
Whistler
To load the text file
mysql>
LOAD DATA LOCAL INFILE '/path/pet.txt' INTO TABLE pet;
If you created the file on Windows with an editor that uses
this statement instead:
mysql>
LOAD DATA LOCAL INFILE '/path/pet.txt' INTO TABLE pet
->
LINES TERMINATED BY '\r\n';
(On an Apple machine running OS X, you would likely want to use
You can specify the column value separator and end of line marker explicitly in the
statement if you wish, but the defaults are tab and linefeed. These are sufficient for the statement to
read the file
If the statement fails, it is likely that your MySQL installation does not have local file capability enabled
by default. See
change this.
When you want to add new records one at a time, the
form, you supply values for each column, in the order in which the columns were listed in the
statement. Suppose that Diane gets a new hamster named "Puffball." You could add a new
TABLE
record using an
mysql>
INSERT INTO pet
->
VALUES ('Puffball','Diane','hamster','f','1999-03-30',NULL);
String and date values are specified as quoted strings here. Also, with INSERT, you can insert
directly to represent a missing value. You do not use
From this example, you should be able to see that there would be a lot more typing involved to load
your records initially using several

3.3.4. Retrieving Information from a Table

The
SELECT
SELECT
what_to_select
FROM
which_table
WHERE conditions_to_satisfy;
what_to_select
columns."
which_table
is optional. If it is present,
satisfy to qualify for retrieval.
3.3.4.1. Selecting All Data
The simplest form of
mysql>
SELECT * FROM pet;
+----------+--------+---------+------+------------+------------+
| name
| owner

Retrieving Information from a Table

pet.txt
Gwen
bird
\N
into the
pet.txt
properly.
pet.txt
Section 6.1.6, "Security Issues with
statement like this:
INSERT
INSERT
statement is used to pull information from a table. The general form of the statement is:
indicates what you want to see. This can be a list of columns, or
indicates the table from which you want to retrieve data. The
conditions_to_satisfy
retrieves everything from a table:
SELECT
| species | sex
containing one record per line, with values separated by tabs,
(backslash, capital-N). For example, the record for
\N
1997-12-09
table, use this statement:
pet
\r\n
LOAD DATA
INSERT
like you do with
\N
statements rather than a single
specifies one or more conditions that rows must
| birth
| death
201
statement. For missing
CREATE TABLE
\N
as a line terminator, you should use
LINES TERMINATED BY
LOAD DATA
LOCAL", for information on how to
statement is useful. In its simplest
LOAD
DATA.
LOAD DATA
|
NULL
'\r'.)
CREATE
NULL
statement.
to indicate "all
*
clause
WHERE

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