zoukankan      html  css  js  c++  java
  • mysql日期函数 当前日期 curdate() , 当前年 year(curdate()), 取date的年份 year(date) ,取date的月份 month(date)

    获取系统当前日期时间: sysdate()
    获取系统当前日期:curdate()
    获取系统当前时间:curtime()
    获取给定日期的年份: year(date)
    获取给定日期的月份:month(date)
    为指定日期增加一个时间间隔的函数:date_add(date,INTERVAL expr unit)
     
    (1) 查询作者的出生年份
    作者出生年份 = 当前年份 - 作者年龄
           = year(curdate()) - age
     
    注: 当前日期 curdate() , 当前年 year(curdate())
     
    (2) 查询显示最新出版日期在今年前半年的作者信息
    select * from authors where year(isbn)=year(curdate()) and month(isbn)>7 ;
    今年,年份是当前年: year(isbn)=year(curdate())
    上半年,月份小于7: month(isbn)<7
     
    注:灵活使用 year()  month()
     
     
     
    每天前进一小步
  • 相关阅读:
    Django ListView实现分页
    redis-pipeline
    MRO
    进程状态
    ORM基本操作回顾
    协程回顾
    线程的回顾
    multiprocessing- 基于进程的并行性
    Fix Curl client hung issue
    Curl request 'Expect: 100-Continue' Issues and Risks
  • 原文地址:https://www.cnblogs.com/maidou199006/p/7405926.html
Copyright © 2011-2022 走看看