Creating and Using a Database If this happens to you (you think you’ve entered a statement but the only response is a  ->  prompt), most likely  mysql  is waiting for the semicolon. If you don’t notice what the prompt is telling you, you might sit there for a while before realizing what you need to do. Enter a semicolon to complete the statement, and mysql  executes it: The  ’>  and  ">  prompts occur during string collection (another way of saying that MySQL is waiting for completion of a string). In MySQL, you can write strings surrounded by either  ’  or  "  characters (for example,  ’hello’  or  "goodbye" ), and  mysql  lets you enter strings that span multiple lines. When you see a  ’>  or  ">  prompt, it means that you have entered a line containing a string that begins with a  ’ or  "  quote character, but have not yet entered the matching quote that terminates the string. This often indicates that you have inadvertently left out a quote character. For example: If you enter this  SELECT  statement, then press  Enter  and wait for the result, nothing happens. Instead of wondering why this query takes so long, notice the clue provided by the  ’>  prompt. It tells you that mysql  expects to see the rest of an unterminated string. (Do you see the error in the statement? The string ’Smith  is missing the second single quotation mark.) At this point, what do you do? The simplest thing is to cancel the query. However, you cannot just type  \c in this case, because  mysql  interprets it as part of the string that it is collecting. Instead, enter the closing quote character (so  mysql  knows you’ve finished the string), then type  \c : The prompt changes back to  mysql> , indicating that  mysql  is ready for a new query. The  ‘>  prompt is similar to the  ’>  and  ">  prompts, but indicates that you have begun but not completed a backtick-quoted identifier. It is important to know what the  ’> ,  "> , and  ‘>  prompts signify, because if you mistakenly enter an unterminated string, any further lines you type appear to be ignored by  mysql —including a line containing QUIT . This can be quite confusing, especially if you do not know that you need to supply the terminating quote before you can cancel the current query. Multiline statements from this point on are written without the secondary ( -> or other) prompts, to make it easier to copy and paste the statements to try for yourself. Once you know how to enter SQL statements, you are ready to access a database. Suppose that you have several pets in your home (your menagerie) and you would like to keep track of various types of information about them. You can do so by creating tables to hold your data and loading 307 3.3 Creating and Using a Database Note mysql>  SELECT * FROM my_table WHERE name = ’Smith AND age < 30; ’>  ’\c mysql> mysql>  SELECT * FROM my_table WHERE name = ’Smith AND age < 30; ’> mysql>  SELECT USER() ->  ; +---------------+ | USER() | +---------------+ | jon@localhost | +---------------+