mysql知識蓄積(三)常用


#    
select * from mmcgi_rawpack_tb where date(time)>2011-07-06;
select * from mmcgi_rawpack_tb where date(time)>'%Y-%m-%d';
#  - 
select time_to_sec(time) from mmcgi_rawpack_tb; 
#  - 
select to_days(time) from mmcgi_rawpack_tb;
#unix    -1970    utc
select unix_timestamp(time) from mmcgi_rawpack_tb;

#         
select * from mmcgi_rawpack_tb where unix_timestamp(time)>unix_timestamp(now())-86400;

#     ,     id    1  
truncate table table_name;

#      
describe tablename;

#        
select * from mmcgi_nodedata_tb where node_data <> "" and node_data <> "0";


            
ts TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
        (      ,         )
ts TIMESTAMP DEFAULT CURRENT_TIMESTAMP
       (          )
ts TIMESTAMP DEFAULT 0 ON UPDATE CURRENT_TIMESTAMP
    (      ,       DATETIME           ?)
ts TIMESTAMP DEFAULT 0



mysql> SELECT * FROM table LIMIT 5,10;  //       6-15

//                        ,           -1: 
mysql> SELECT * FROM table LIMIT 95,-1; //       96-last.

//         ,             : 
mysql> SELECT * FROM table LIMIT 5;     //    5     

//    ,LIMIT n     LIMIT 0,n。

  
mysql> \s
  status;

  mysql     :
show character set;

         :
ALTER TABLE mmcgi_hardcodetag_tb CONVERT TO CHARACTER SET utf8;

 show full columns from tenant;    tenant          。
 
If you have any questions or ideas ,please feel free to contact me : )
thx.^^
QQ: 1623213673