zoukankan      html  css  js  c++  java
  • 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天%';

  • 相关阅读:
    Count on a tree
    图论1 1009
    DP2 1008
    DP1 1008
    NOIP 模拟 1006
    2019 CSP-S 初赛退役记
    9.13——TEST NOIP模拟测试
    [洛谷P2387][NOI2014]魔法森林
    [洛谷P2596][ZJOI2006]书架
    [BZOJ4241]历史研究
  • 原文地址:https://www.cnblogs.com/liyuanhong/p/10375539.html
Copyright © 2011-2022 走看看