個人環境:windows十、MySQL5.7html
首先,保證已經鏈接上了MySQL數據庫服務器。mysql
簡單的查詢:sql
SELECT VERSION(), CURRENT_DATE;
結果以下:數據庫
上圖是一個簡單的查詢,查詢結果是mysql的版本和當前的時間。windows
mysql查詢語句說明:服務器
mysql>
"提示符表示你能夠輸入新的查詢語句;mysql查詢語句的關鍵字不區分大小寫,如下查詢語句結果相同:ide
SELECT VERSION(), CURRENT_DATE; select version(), current_date; SeLeCt vErSiOn(), current_DATE;
結果以下:ui
在查詢語句中進行計算:code
SELECT SIN(PI()/4), (4+1)*5;
一行輸入多個查詢語句,每一個語句用";"分號結束:htm
SELECT VERSION(); SELECT NOW();
多行輸入1條語句:
SELECT USER() , CURRENT_DATE;
結果以下:
"\c"取消未輸入結束的語句:
SELECT USER() \c
結果以下:
提示符表明的狀態:
Prompt | Meaning |
---|---|
mysql> |
Ready for new query |
-> |
Waiting for next line of multiple-line query |
'> |
Waiting for next line, waiting for completion of a string that began with a single quote (「' 」) |
"> |
Waiting for next line, waiting for completion of a string that began with a double quote (「" 」) |
`> |
Waiting for next line, waiting for completion of an identifier that began with a backtick (「` 」) |
/*> |
Waiting for next line, waiting for completion of a comment that began with /* |
結果以下:
參考: