Issuing MySQL commands

mysql> select version();
+——————+
| version()        |
+——————+
| 5.1.30-community |
+——————+
1 row in set (0.06 sec)

From the query and query about let’s discuss about some default characters of issuing mysql commands and it’s output.

1)MySQL commands end with semicolon. An exception is quit command.

2)After command is executed in server mysql shows mysql> prompt in order to indicate that it is suitable to take another input.

3)mysql displays query output in tabular form (rows and columns) by default.

4)After query is executed, it displays number of rows returned by the query as well as clock time needed for the query.

Let’s now see another example.

mysql> select version()
-> ,
-> ‘USER()
‘> ‘
-> ,
-> “NOW()
“> ”
-> ;
+——————+———+——–+
| version()        | USER()
| NOW()
|
+——————+———+——–+
| 5.1.30-community | USER()
| NOW()
|
+——————+———+——–+
1 row in set (0.00 sec)
mysql>

It displays version number information and then displays two strings ‘USER()’ and “NOW()”. But look at the mysql prompt. It changes from -> to ‘>, -> to “> , -> to mysql> etc. That prompt indicates that it is waiting for a letters(s) that mysql expects.

Following is the list of mysql prompts with their meaning.

1)mysql> : Mysql is ready to accept commands.

2)-> : Mysql waits for next line of multiple-line command.

3)’> : Waiting for next line plus waiting for completion of a string that began with a single quote (‘).

4)”> : Waiting for next line plus waiting for completion of a string that began with a double quote (“).

5)`> : Waiting for next line plus waiting for completion of an identifier that began with a backtick (`).

6)/*> : Waiting for next line plus waiting for completion of a comment that began with /*.

Advertisements
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: