Here is a simple query that asks the server to tell you its version number and the current date. Type it in as shown here following the mysql>  prompt and press Enter: 

mysql> SELECT VERSION(), CURRENT_DATE; +-----------+--------------+ | VERSION() | CURRENT_DATE | +-----------+--------------+ | 5.8.0-m17 | 2015-12-21 | +-----------+--------------+ 1 row in set (0.02 sec) mysql> 

This query illustrates several things about mysql : 

•A query normally consists of an SQL statement followed by a semicolon. (There are some exceptions where a semicolon may be omitted. QUIT , mentioned earlier, is one of them. We’ll get to others later.) 

•When you issue a query, mysql  sends it to the server for execution and displays the results, then prints another mysql>  prompt to indicate that it is ready for another query. 

• mysql  displays query output in tabular form (rows and columns). The first row contains labels for the columns. The rows following are the query results. Normally, column labels are the names of the columns you fetch from database tables. If you’re retrieving the value of an expression rather than a table column (as in the example just shown), mysql  labels the column using the expression itself. 

• mysql  shows how many rows were returned and how long the query took to execute, which gives you a rough idea of server performance. These values are imprecise because they represent wall clock time (not CPU or machine time), and because they are affected by factors such as server load and network latency. (For brevity, the “rows in set”  line is sometimes not shown in the remaining examples in this chapter.) 

Keywords may be entered in any lettercase. The following queries are equivalent: 

mysql> SELECT VERSION(), CURRENT_DATE; mysql> select version(), current_date; mysql> SeLeCt vErSiOn(), current_DATE; 

Here is another query. It demonstrates that you can use mysql  as a simple calculator: 

mysql> SELECT SIN(PI()/4), (4+1)*5; +------------------+---------+ | SIN(PI()/4) | (4+1)*5 | +------------------+---------+ | 0.70710678118655 | 25 | +------------------+---------+ 1 row in set (0.02 sec) 

The queries shown thus far have been relatively short, single-line statements. You can even enter multiple statements on a single line. Just end each one with a semicolon: 

mysql> SELECT VERSION(); SELECT NOW(); +-----------+ | VERSION() | +-----------+ | 8.0.13 | +-----------+ 1 row in set (0.00 sec) +---------------------+ | NOW() | +---------------------+ | 2018-08-24 00:56:40 | 

