Learning Mysql



Download 4.24 Mb.
View original pdf
Page94/366
Date04.08.2023
Size4.24 Mb.
#61806
1   ...   90   91   92   93   94   95   96   97   ...   366
Learning MySQL
-> FROM user;
+------+--------------------------+
Style, Case, and Semicolons | 97


| User | Host |
+------+--------------------------+
| | localhost |
| root | localhost |
| | saied-ltc.cs.rmit.edu.au |
| root | saied-ltc.cs.rmit.edu.au |
+------+--------------------------+
4 rows inset sec)
We often use this style in this book, because it helps long statements fit in the margins of a page. Notice that the monitor shows you a different prompt (
->
) to indicate that it’s waiting for you to enter more of your SQL statement or to type in a semicolon.
In fact, you can add whitespace—such as space and tab characters—anywhere between the components of a statement to improve its formatting, and we often do this in our longer statements. Of course, because whitespace separates keywords and values, you can’t add space within the keywords or values themselves for example, if you type the keyword
SELECT
as SELECT, you’ll get an error.
In contrast to SQL statements, you can’t span the MySQL monitor’s own commands over more than one line. This is because the semicolon isn’t actually required for these,
and just pressing the Enter key has the same effect. For example, the
USE
command tells
MySQL that you want to use a particular database. The following works fine:
mysql> USE test
Database changed
However, if you try to span the command over more than one line, you won’t get far:
mysql> USE
ERROR:
USE must be followed by a database name
The Monitor Help
The monitor has a handy
HELP
command that you can use to get more information on the monitor commands or SQL syntax. If you type HELP and press the Enter key, you’ll get a list of commands the monitor understands:
mysql> HELP
For information about MySQL products and services, visit:
http://www.mysql.com/
For developer information, including the MySQL Reference Manual, visit:
http://dev.mysql.com/
To buy MySQL Network Support, training, or other products, visit:
https://shop.mysql.com/
List of all MySQL commands:
Note that all text commands must be first online and end with ';'
? (\?) Synonym for `help'.
clear (c) Clear command.
connect (r) Reconnect to the server. Optional arguments are db and host.
delimiter (d) Set statement delimiter. NOTE Takes the rest of the line as new

Download 4.24 Mb.

Share with your friends:
1   ...   90   91   92   93   94   95   96   97   ...   366




The database is protected by copyright ©ininet.org 2024
send message

    Main page