mysql> SELECT NOW( ); +———————+ | NOW( )
mysql> SELECT NOW( ); +———————+ | NOW( ) | +———————+ | 2001-07-04 10:27:23 | +———————+ mysql> SELECT -> NOW( )g +———————+ | NOW( ) | +———————+ | 2001-07-04 10:27:28 | +———————+ Notice for the second query that the prompt changes from mysql> to -> on the second input line. mysql changes the prompt this way to let you know that it’s still waiting to see the query terminator. Be sure to understand that neither the ; character nor the g sequence that serve as query terminators are part of the query itself. They’re conventions used by the mysql program, which recognizes these terminators and strips them from the input before sending the query to the MySQL server. It’s important to remember this when you write your own programs that send queries to the server (as we’ll begin to do in the next chapter). In that context, you don’t include any terminator characters; the end of the query string itself signifies the end of the query. In fact, adding a terminator may well cause the query to fail with an error. 1.11 Selecting a Database 1.11.1 Problem You want to tell mysql which database to use. 1.11.2 Solution Name the database on the mysql command line or issue a USE statement from within mysql. 1.11.3 Discussion When you issue a query that refers to a table (as most queries do), you need to indicate which database the table is part of. One way to do so is to use a fully qualified table reference that begins with the database name. (For example, cookbook.limbs refers to the limbs table in the cookbook database.) As a convenience, MySQL also allows you to select a default (current) database so that you can refer to its tables without explicitly specifying the database name each time. You can specify the database on the command line when you start mysql: % mysql cookbook If you provide options on the command line such as connection parameters when you run mysql, they should precede the database name:
Note: If you are looking for good and high quality web space to host and run your application check Lunarwebhost PHP Web Hosting services