How to use MySQL functions to convert IP addresses and numbers
Use MySQL built-in functions to convert IP addresses and numbers
Using two built-in functions
Inet_aton: converts an IP address to a number.
Inet_ntoa: convert a numeric type to an IP address
Make full use of the MySQL built-in format Function
Especially when processing character formats, for example, to convert 12345 to 12,345, you only need to use: Format (12345, 0). If format (12345, 2) is used, 12,345.00 is displayed...
Use MySQL built-in functions to handle timestamp Problems
Eg: Select from_unixtime (unix_timestamp (), '% Y % d % m % H: % I: % S % x ');
Results: 2004 3rd August 03:35:48 2004
Use mysql_convert_table_format to convert the table Type
DBI and DBD mysql-related modules are required for use. Example:
Mysql_convert_table_format-user = root-Password = 'xx'-type = MyISAM test yejr
Modify the field name in the MySQL table
Alter table tb_name change old_col new_col definition...
Use temporary variables
Select @ var1: = A1 + A2 as a_sum, @ var2: = b1 + B2 as B _sum, @ var1 + @ var2 as total_sum from test_table xxx;
Store IP addresses of the int type
The original error was deemed to be sufficient only when the bigint type was used. later it was found that the int unsigned type was sufficient.
Use the IF function to quickly modify the enum Field Value
Example:
Update Rule Set enable = If ('0' = Enable, '1', '0') Where xxx;
Enable type: Enum ('0', '1') not null default '0 ′
Transactions cannot be nested