Database Reference
In-Depth Information
+----------------+
1 row in set (0.01 sec)
You now have one table, books . Notice that the results are enclosed with ASCII text to
look like a table of data, as you might draw it on a piece of paper. Notice also the message
after the table. It says that one row is in the set, meaning that books is the only table in
the database. The time in parentheses that you will see after running every SQL statement
indicates how long it took for the server to process the request. In this case, it took my
server 0.01 seconds. I ran that statement from my home computer in Milan, Italy, but us-
ing my server in Tampa, Florida in the U.S. That's a pretty quick response. Sometimes it's
even faster and shows 0.00 seconds, because the lapse in time was not enough to register.
From this point forward, I will leave out these lines of status to save space and to keep the
clutter down, unless there's something relevant to discuss. For the same reason, I'm not
including the mysql> prompts. You'll have to learn when something is entered from the
mysql client versus the operating system shell — although I will usually indicate when to
enter something from the operating system shell. So from now on, I'll combine input and
output like this:
SHOW TABLES FROM test;
+----------------+
| Tables_in_test |
+----------------+
| books |
+----------------+
You can tell what you're supposed to enter because it's bold, whereas the output is not.
For each of these SQL statements, we have to specify the database name. If you will be
working mainly in one database (you usually will be), you can set the default database so
that you don't have to specify the database each time.To do this, enter a USE command:
USE test
NOTE
Incidentally, if your server doesn't have the test database, you can create it by justentering CREATE
DATABASE test; on the server first.
Because this is an instruction for the mysql client and not the server, the usual ending
semicolon is not needed. The client will change the default database on the server for the
client to the one given, making it unnecessary to specify table names without a preceding
Search WWH ::




Custom Search