Some knowledge mysql

Common practical sql statement:

1.example:   SELECT *,FROM_UNIXTIME(f_create_time/1000,'%Y-%m-%d %H:%i:%s') date from report.t_org_exam_num_day  ORDER BY date desc

   FROM_UNIXTIME () to convert a time in milliseconds for the date, the time, hour

2. built mysql query time table: SELECT CREATE_TIME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'db_campus (library name)' AND TABLE_NAME = 'tb_ilovi_device (table)';

View MySQL table structure simple commands.

A brief description table structure, field types desc tabl_name;
display table structure, field type, primary key, the attribute if it is blank, but not the foreign key.
Second, the comment information look-up table column
select * from information_schema.columns where table_schema = ' db' # table where the database
and table_name = 'tablename'; # you want to check the table
three or query column name and comment Only
the SELECT column_name,
column_comment from = WHERE TABLE_SCHEMA from information_schema.columns 'DB' and
table_name = 'TableName';
IV # Display Notes
select table_name, table_comment from information_schema.tables where table_schema = 'db' and table_name = 'tablename'

 

See MYSQL database for all users
mysql> SELECT DISTINCT CONCAT ( 'User :' '', user, '' '@' '', host, '' ';') AS query FROM mysql.user;

See specific database user permissions for a
MySQL> Show Grants for 'cactiuser' @ '%';   

MySQL> SELECT * from the mysql.user WHERE user = 'cactiuser' \ G   

See table structure needs of a particular user entry table structure may be combined to query
mysql> desc mysql.user;

 

Mysql database comes with four analytical database 

See Reference URL: https://www.cnblogs.com/bobi-PHP-blog/p/7508660.html

 

Guess you like

Origin www.cnblogs.com/lipengsheng-javaweb/p/11419209.html