Importance of MYSQL beginners (1) prompt _ MySQL

Source: Internet
Author: User
Importance of MYSQL beginners (I) prompt bitsCN.com

Prompt
Description
Mysql>
Prepare to accept the new command.
->
Wait for the next line of the multi-line command.
'>
Wait for the next line, and wait for the end of the string starting with single quotes.
">
Wait for the next line, and wait for the end of the string starting with double quotation marks.
'>
Wait for the next line, and wait for the end of the identifier starting with the reverse oblique point.
/*>
Wait for the next line and wait for the end of comments starting.

When you want to issue a command on a single line, multiple lines of statements are usually "accidentally", but the semicolon is not terminated. In this case,MysqlWait for further input:

mysql> SELECT USER()
    ->

If this happens (you think the statement is finished, but there is only one-> Prompt Response), it is very likelyMysqlWaiting for the semicolon. If you do not notice the prompt, you may sit down for a while before realizing what you need to do. Enter a semicolon to complete the statement,MysqlWill execute:

mysql> SELECT USER()
    -> ;
+---------------+
| USER()        |
+---------------+
| jon@localhost |
+---------------+

A '> and "> prompt (prompting MySQL to wait for the end of the string) will appear during string collection ). In MySQL, you can write a string (for example, 'hello' or "goodbye") that is enclosed by ''' or '"', andMysqlYou can enter a string that spans multiple rows. When you see a '> or "> prompt, this means that you have entered a line containing a string starting with '''' or, however, no matching quotation marks are entered for the ending string. This shows that you accidentally omitted a quotation mark character. For example:

mysql> SELECT * FROM my_table WHERE name = 'Smith AND age < 30;
    '>

If you enter the SELECT statementEnter (Press enter)Key and wait for the result. nothing appears. Don't be surprised, "Why is the query so long ?", Note: "> clues provided by the prompt. It tells youMysqlExpect to see the rest of an unterminated string. (Do you see errors in statements? String "Smith dropped the second quotation mark .)

In this step, what should you do? The simplest is to cancel the command. However, in this case, you cannot just input/c, becauseMysqlInterpret it as part of the string it is collecting! Instead, enter the characters in the closed quotation marks (suchMysqlKnow that you have completed the string), and then enter/c:

mysql> SELECT * FROM my_table WHERE name = 'Smith AND age < 30;
    '> '/c
mysql>

Prompt back to mysql>, displayMysqlYou are ready to accept a new command.

'> The prompt is similar to'> and "> the prompt, but it indicates that you have started but not ended with '> The start identifier.

It is important to know the meanings of '> and "> the prompt, because if you mistakenly enter an unterminated string, any line entered later will beMysqlIgnore -- include rows containing QUIT! This may be confusing, especially if you do not know before canceling the current command, you need to provide the ending quotation marks.

BitsCN.com

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.