zoukankan      html  css  js  c++  java
  • Mysql查询的一些操作(查表名,查字段名,查当月,查一周,查当天)

    查询数据库中所有表名
    select table_name from information_schema.tables where table_schema='tools' and table_type='base table';
    查询指定数据库中指定表的所有字段名column_name

    select column_name from information_schema.columns where table_schema='tools' and table_name='content_noteinfo'

    select * from wap_content where week(created_at) = week(now)
    如果你要严格要求是某一年的,那可以这样
    查询一天:
    select * from table where to_days(column_time) = to_days(now());
    select * from table where date(column_time) = curdate();
    查询一周:
    select * from table  where DATE_SUB(CURDATE(), INTERVAL 7 DAY) <= date(column_time);
    查询一个月:
    select * from table  where DATE_SUB(CURDATE(), INTERVAL INTERVAL 1 MONTH) <= date(column_time);
     
  • 相关阅读:
    Vue
    linux-----docker
    linux基础
    Flask基础
    websocket
    css
    Mysql数据库基础
    IO多路复用
    线程和协程
    sh_02_del关键字
  • 原文地址:https://www.cnblogs.com/benpao/p/10771211.html
Copyright © 2011-2022 走看看