mysql常用语句

数据库与表操作

显示数据库:

show databases;

切换数据库:

use  theDatabase

显示当前数据库的所有表

show tables

展示表属性:

show create table theTable

查询数据库的记录条数:

select count(*) as total from theTable

mysq中的时间向前移一天:

update theTable set create_time=create_time-86400 where id=566

mysql将查询的时间错发转换为时间:

select uid,nickname,from_unixtime(create_time) from theTable where nickname="lyh";

单个字段的查询与操作

Mysql替换某个字段中的字符串:

updat 表名 set 字段名=replace(字段名,'原来的内容','替换后的内容')
update wp_posts set post_content = replace(post_content,'39.105.62.250/fityoo/','www.fityoo.cn/');

Mysql查询某个字段包含某个内容:
select post_content from wp_posts where post_content like '%365天%';

原文地址:https://www.cnblogs.com/liyuanhong/p/10375539.html