Getting Started with MySQL

Login to MySQL 
mysql -u root -p

Then enter the password.

quit MySQL  

exit
Operators and Functions
1 Character functions LIKE(), CONCAT();
2 Numerical operators and functions
CEIL() rounds up, FLOOR() rounds down, MOD rounding, DIV rounding, POWER() exponentiation, ROUND() rounding, TRUNCATE() number truncation;
3 Comparison operators and functions
BETWEEN...AND ,IN ,IS
4 Date Time Functions
NOW(), CURDATE(), CURTIME(); DATE_ADD(), DATEDIFF(); DATEo_FORMAT
5 Information functions
CONNECTION_ID(), DATABASE(), LAST
6 Aggregate functions
AVG(), COUNT(), MIN(), MAX(), SUM()
7 Encryption functions
MD5(), PASSWORD();
Introduction to custom functions
There are two necessary conditions for a custom function: 1 Parameters: Parameters can have zero or more 2 Return values: There can only be one return value
A function body with a composite structure needs to be included with BEGIN...END
MySQL stored procedure
Stored procedure: is a precompiled collection of sql statements and control statements, stored by name and processed as a unit
Parameters: input type output type input && output
CREATE: CREATE PEOCEDURE
Note: (1) When creating a stored procedure or custom function, use delimiter to modify the delimiter
(2) If the function body or procedure body has multiple statements, it needs to be included in the BEGIN END statement block
(3) The stored procedure needs to be called using CALL

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325940827&siteId=291194637