Mysql Study Notes 001 and mysql Study Notes 001
Mysql is case-insensitive and requires the server to tell him the version number.
Select version ();
Mysql> select version ();
+ ----------- +
| VERSION () |
+ ----------- +
| 5.7.18 |
+ ----------- +
1 row in set (0.09 sec)
Mysql>
Current Time
SELECT CURRENT_TIME ();
Mysql> SELECT CURRENT_TIME ();
+ ---------------- +
| CURRENT_TIME () |
+ ---------------- +
| 13:57:15 |
+ ---------------- +
1 row in set (0.00 sec)
Current date
SELECT CURRENT_DATE ();
Mysql> SELECT CURRENT_DATE ();
+ ---------------- +
| CURRENT_DATE () |
+ ---------------- +
|
+ ---------------- +
1 row in set (0.00 sec)
Mysql>
Another now
Select now ();
Mysql> select now ();
+ --------------------- +
| NOW () |
+ --------------------- +
| 13:57:43 |
+ --------------------- +
1 row in set (0.00 sec)
Mysql>
Simple Calculator
Mysql> select sin (PI ()/4), (4 + 1) * 5;
+ -------------------- + --------- +
| SIN (PI ()/4) | (4 + 1) * 5 |
+ -------------------- + --------- +
| 1, 0.7071067811865475 | 25 |
+ -------------------- + --------- +
1 row in set (0.00 sec)
Mysql>
Who am I
Select user ();
Mysql> select user ();
+ ---------------- +
| USER () |
+ ---------------- +
| Root @ localhost |
+ ---------------- +
1 row in set (0.00 sec)
Mysql>
If I decide not to execute a command in the input process, enter \ c to cancel it.
Mysql> SELECT
-> USER ()
-> \ C
Mysql>
The following table shows the various prompts that you can see and briefly describes the mysql status they represent.
For example, I want to find an 18-year-old girl named Lu in the beautiful girl table, but I have no hands left. I accidentally typed it wrong...
Mysql> SELECT * from beautifulgirls where name = 'lu AND age = 18
'>' \ C
Mysql>
In this way, I can find the pretty girl I want to find (\ happy)