个人环境: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 /* |
结果以下:
参考: