• Sqlite常用sql语句


    sqlite常用sql语句 
    --返回UTC时间
    select CURRENT_TIMESTAMP;
    --返回本地时间
    select datetime(CURRENT_TIMESTAMP,'localtime');
    --时间转换,时间转换时要求: yyyy-MM-dd,例如: 2008-08-09
    SELECT datetime('2008-12-22') AS [My Time];
    SELECT datetime('2008-12-22') AS "My Time";--必须为双引号
    SELECT date('now', 'localtime');--返回本地日期
    SELECT time('now', 'localtime');--返回本地当前时间
    select CURRENT_TIME;--返回当前UTC时间
    select CURRENT_DATE;--返回当前UTC日期
    select julianday('2008-12-22') - julianday('2008-12-21');--日期比较
    --Compute the current date.
    SELECT date('now');
    --Compute the last day of the current month.
    SELECT date('now','start of month','+1 month','-1 day');
    --Compute the date and time given a unix timestamp 1092941466.
    SELECT datetime(1092941466, 'unixepoch');
    --Compute the date and time given a unix timestamp 1092941466, and compensate for your local timezone.
    SELECT datetime(1092941466, 'unixepoch', 'localtime');
    --Compute the current unix timestamp.
    SELECT strftime('%s','now');
    --Compute the number of days since the signing of the US Declaration of Independent.
    SELECT julianday('now') - julianday('1776-07-04');
    --Compute the number of seconds since a particular moment in 2004:
    SELECT strftime('%s','now') - strftime('%s','2004-01-01 02:34:56');
    --Compute the date of the first Tuesday in October for the current year.
    SELECT date('now','start of year','+9 months','weekday 2');
    --Compute the time since the unix epoch in seconds (like strftime('%s','now') except includes fractional part):
    SELECT (julianday('now') - 2440587.5)*86400.0;
    
    Select rowid,* From keys order by rowid asc Limit 5 Offset 5 ;--SQLite分页显示,表示跳过5行,再取5行,即第二页

  • 相关阅读:
    写在之前
    Fedora Core 3安装杂记(三)
    Fedora Core 3安装杂记(一)
    Firefox 1.0真的挺好用的
    发现Google加了英文页面翻译功能(Beta)
    Fedora Core 3安装杂记(四)
    在FC3的日子里……
    ASP面向对象编程探讨及比较
    显卡千万不能买带风扇的……
    字符串(strcat)
  • 原文地址:https://www.cnblogs.com/smartsmile/p/6234219.html
Copyright © 2020-2023  润新知