首页 > 数据库技术 > 详细

mysql常用语句

时间:2019-02-14 17:01:59      阅读:186      评论:0      收藏:0      [点我收藏+]

数据库与表操作

显示数据库:

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天%‘;

mysql常用语句

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

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!