Oracle 5.0 Reference Manual page 215

Table of Contents

Advertisement

+----------------+--------------+
| VERSION()
| CURRENT_DATE |
+----------------+--------------+
| 5.0.7-beta-Max | 2005-07-11
+----------------+--------------+
1 row in set (0.01 sec)
mysql>
This query illustrates several things about mysql:
• A command normally consists of an SQL statement followed by a semicolon. (There are some
exceptions where a semicolon may be omitted. QUIT, mentioned earlier, is one of them. We'll get to
others later.)
• When you issue a command,
then prints another
mysql>
displays query output in tabular form (rows and columns). The first row contains labels for
mysql
the columns. The rows following are the query results. Normally, column labels are the names of the
columns you fetch from database tables. If you're retrieving the value of an expression rather than a
table column (as in the example just shown),
shows how many rows were returned and how long the query took to execute, which gives
mysql
you a rough idea of server performance. These values are imprecise because they represent wall
clock time (not CPU or machine time), and because they are affected by factors such as server load
and network latency. (For brevity, the "rows in set" line is sometimes not shown in the remaining
examples in this chapter.)
Keywords may be entered in any lettercase. The following queries are equivalent:
mysql>
SELECT VERSION(), CURRENT_DATE;
mysql>
select version(), current_date;
mysql>
SeLeCt vErSiOn(), current_DATE;
Here is another query. It demonstrates that you can use
mysql>
SELECT SIN(PI()/4), (4+1)*5;
+------------------+---------+
| SIN(PI()/4)
| (4+1)*5 |
+------------------+---------+
| 0.70710678118655 |
+------------------+---------+
1 row in set (0.02 sec)
The queries shown thus far have been relatively short, single-line statements. You can even enter
multiple statements on a single line. Just end each one with a semicolon:
mysql>
SELECT VERSION(); SELECT NOW();
+----------------+
| VERSION()
|
+----------------+
| 5.0.7-beta-Max |
+----------------+
1 row in set (0.00 sec)
+---------------------+
| NOW()
+---------------------+
| 2005-07-11 17:59:36 |
+---------------------+
1 row in set (0.00 sec)
A command need not be given all on a single line, so lengthy commands that require several lines are
not a problem.
determines where your statement ends by looking for the terminating semicolon,
mysql
not by looking for the end of the input line. (In other words,
input lines but does not execute them until it sees the semicolon.)
Entering Queries
|
sends it to the server for execution and displays the results,
mysql
prompt to indicate that it is ready for another command.
25 |
|
195
labels the column using the expression itself.
mysql
as a simple calculator:
mysql
accepts free-format input: it collects
mysql

Advertisement

Table of Contents
loading

This manual is also suitable for:

Mysql 5.0

Table of Contents