information Functions
The commonly used information functions are:
(1) View database connection ID and current database
SELECT connection_id ();
SELECT DATABASE ();
(2) Check the ID number of the last input record
ALTER TABLE Test ADD ID SMALLINT UNSIGNED keyauto_increment first;
INSERT Test (First_name,last_name) VALUES (' 11 ', ' 22 ');
SELECT last_insert_id ();
SELECT * from Test;
(3) View current user and version information (already used)
SELECT USER ();
SELECT VERSION ();
aggregation Functions
Common aggregation functions:
One common denominator of aggregate functions is that there is only one return value.
(1) averaging using AVG () function
Use T2;
SHOW TABLES;
SELECT ROUND (AVG (Goods_price), 2) as Avg_price from Tdb_goods;
(2) using the Count function, the maximum function, and the minimum value function
SELECT COUNT (goods_id) as counts from Tdb_goods;
SELECT MAX (goods_price) as Max_price from Tdb_goods;
SELECT MIN (Goods_price) as Min_price from Tdb_goods;
(3) sum with sum () function
SELECT SUM (goods_price) as Sum_price from Tdb_goods;
Cryptographic Functions
Common cryptographic functions:
examples of using cryptographic functions
SELECT MD5 (' admin ');
SELECT PASSWORD (' admin ');
Recommendations for using cryptographic functions:
If it is for future web pages to prepare, then we try to use MD5 (); PASSWORD () There is only one use, that is, we are repairing the client
You can use it when you have a password.
To modify the format of a client password:
SET password=password (' 123123 ');
MySQL Learning 19: Information functions of operators and functions, aggregate functions, cryptographic functions