SQLite 的默认时间 转自:http://www.cnblogs.com/pennant/archive/2011/08/11/2134897.html

select strftime('%Y-%m-%d %H:%M:%S','now')

这个查询的结果是 UTC时间,即 +8h 才和电脑时间相同。

select time('now')

这个查询的结果是 01:02:03 ,也要 +8h 才和电脑时间相同。

select date('now')

这个查询的结果是 2017-03-02

select datetime('now')

这个查询的结果是 2017-03-02 01:02:03

  %d 一月中的第几天01-31

  %f 小数形式的秒,SS.SSSS

  %H 小时00-24

  %j 一年中的第几天01-366

  %J Julian Day Numbers

  %m 月份01-12

  %M 分钟00-59

  %s 从1970-01-01日开始计算的秒数

  %S 秒00-59

  %w 星期,0-6,0是星期天

  %W 一年中的第几周00-53

  %Y 年份0000-9999

  %% %百分号

SQLite: Data Types - 数据类型

The following is a list of datatypes available in SQLite, which includes string, numeric, date/time, and large object datatypes.

For simplicity's sake, SQLite essentially uses these basic datatypes:

  • TEXT
  • INTEGER
  • NUMERIC
  • REAL
  • NONE

To be compatible with other SQL databases, SQLite allows you to use the common datatype names that you've seen in other databases and maps them to their basic SQLite datatypes (listed above).

Let's look at the common datatypes names that SQLite lets you define.

String Datatypes

All string datatypes in SQLite are converted to a TEXT datatype. If you try to specify a size for a string datatype, SQLite will ignore it, as it does not allow size restrictions on string datatypes.

The following are the String Datatypes in SQLite:

Data Type Syntax Explanation
CHAR(size) Equivalent to TEXT (size is ignored)
VARCHAR(size) Equivalent to TEXT (size is ignored)
TINYTEXT(size) Equivalent to TEXT (size is ignored)
TEXT(size) Equivalent to TEXT (size is ignored)
MEDIUMTEXT(size) Equivalent to TEXT (size is ignored)
LONGTEXT(size) Equivalent to TEXT (size is ignored)
NCHAR(size) Equivalent to TEXT (size is ignored)
NVARCHAR(size) Equivalent to TEXT (size is ignored)
CLOB(size) Equivalent to TEXT (size is ignored)

Numeric Datatypes

All numeric datatypes in SQLite are converted to INTEGER, NUMERIC, or REAL datatypes.

The following are the Numeric Datatypes in SQLite:

Data Type Syntax Explanation
TINYINT Equivalent to INTEGER
SMALLINT Equivalent to INTEGER
MEDIUMINT Equivalent to INTEGER
INT Equivalent to INTEGER
INTEGER Equivalent to INTEGER
BIGINT Equivalent to INTEGER
INT2 Equivalent to INTEGER
INT4 Equivalent to INTEGER
INT8 Equivalent to INTEGER
NUMERIC Equivalent to NUMERIC
DECIMAL Equivalent to NUMERIC
REAL Equivalent to REAL
DOUBLE Equivalent to REAL
DOUBLE PRECISION Equivalent to REAL
FLOAT Equivalent to REAL
BOOLEAN Equivalent to NUMERIC

Date/Time Datatypes

All date or time datatypes in SQLite are converted to NUMERIC datatypes.

The following are the Date/Time Datatypes in SQLite:

Data Type Syntax Explanation
DATE Equivalent to NUMERIC
DATETIME Equivalent to NUMERIC
TIMESTAMP Equivalent to NUMERIC
TIME Equivalent to NUMERIC

Large Object (LOB) Datatypes

The following are the LOB Datatypes in SQLite:

Data Type Syntax Explanation
BLOB Equivalent to NONE

[转]SQLite 经验集的更多相关文章

  1. [html]经验集

    禁止默认的右键菜单: window.document.oncontextmenu = function(){ return false;} WebBrowser 控件用法:(手动填充内容) // 首先 ...

  2. [转]Oracle 经验集

    -- 转换字符串为日期格式 to_date('2011-12-30 11:54:30','yyyy-MM-dd:hh24:mi:ss') Oracel 用 C# 连接,Microsoft 自带的 Sy ...

  3. [转]Windows 经验集

    Windows Server 2012 R2 显示 这台电脑 图标方法: 来自:https://jingyan.baidu.com/article/f25ef2544f6883482c1b82e5.h ...

  4. [转][Dapper]SQL 经验集

    condition.Append(" AND ChineseName like @name"); p.Add("@name", "%" + ...

  5. [java]经验集

    Calendar c = Calendar.getInstance(); c.set(1999,12,21); SimpleDateFormat sdf = new SimpleDateFormat( ...

  6. [Java.web][eclipse]经验集

    自动提示部分内容来自:http://www.cnblogs.com/mashuangying2016/p/6549991.html 使用 Eclipse 调试 Tomcat 的设置: Window - ...

  7. [转][c#]注册表经验集

    在 win7 64位的系统中,为了将程序做成绿化版(单EXE文件),一些设置准备放到 regedit(注册表)中. 测试时发现网上的 demo 可以读,但写的值调试不报错,相应位置却不存在,困扰了许久 ...

  8. [转]加密经验集 => C#

    下载地址 代码摘自 C#高级编程(第7版) 第579页 不对称加密

  9. [转]MySQL 经验集

    -- my.ini -> 在 [mysqld] 节点下加入一行 skip-grant-tables 然后重启服务 -- 接下来无密码登录到 mysql 执行以下命令 use mysql show ...

随机推荐

  1. 【ecmascript】Javascript 严格模式详解【转】

    一.概述 除了正常运行模式,ECMAscript 5添加了第二种运行模式:"严格模式"(strict mode).顾名思义,这种模式使得Javascript在更严格的条件下运行. ...

  2. Elasticsearch 在分布式系统中深度分页问题

    理解为什么深度分页是有问题的,我们可以假设在一个有 5 个主分片的索引中搜索. 当我们请求结果的第一页(结果从 1 到 10 ),每一个分片产生前 10 的结果,并且返回给 协调节点 ,协调节点对 5 ...

  3. ubuntu安装搜狗输入法的相关问题

    最近换了一次电脑,要重新装系统,就选择了ubuntu14.04 LTS版本的,这个版本官方支持到2019年了,所以相对来说比较稳定,也不用担心软件源的问题.不像14.10那样,现在官方已经没有软件源的 ...

  4. 每周荐书:Kotlin、分布式、Keras(评论送书)

    每周荐书:Kotlin.分布式.Keras(评论送书) 感谢大家对每周荐书栏目的支持,先公布下上周中奖名单 法式三文鱼 名优秀评论可以免费获得此书.   Kotlin实战 首著席卷而来 Android ...

  5. dyld: lazy symbol binding failed: Symbol not found: ___sincosf_stret

    This is the error I get: dyld: lazy symbol binding failed: Symbol not found: ___sincosf_stret Refere ...

  6. SPU - SKU - ARPU

    商品和单品: 单品:汉语中的“个”  例如,iphone是一个单品,但是在淘宝上当很多商家同时出售这个产品的时候,iphone就是一个商品了 商品:淘宝叫item,京东叫product,商品特指与商家 ...

  7. I.MX6 linux eGalaxTouch 自动获取设备节点

    I.MX6 linux eGalaxTouch 自动获取设备节点 \\\\\\\\\\\\\\-*- 目录 -*-///////////// | 一. 需求: | 二. /proc/bus/input ...

  8. vue之element-ui设置全局弹出框

    这样的需求,在主要功能完成后,需要进行交互效果的完善,需要给请求api的时候添加一个加载中的一个弹出框.但是每个页面每个页面过的话,会很费时间和精力,这里我们可以采用element-ui中的服务式弹出 ...

  9. 【Python爬虫学习笔记(2)】正则表达式(re模块)相关知识点总结

    1. 正则表达式 正则表达式是可以匹配文本片段的模式. 1.1 通配符 正则表达式能够匹配对于一个的字符串,可以使用特殊字符创建这类模式.(图片来自cnblogs) 1.2 特殊字符的转义 由于在正则 ...

  10. Codeforces 559C Gerald and Giant Chess【组合数学】【DP】

    LINK 题目大意 有一个wxh的网格,上面有n个黑点,问你从(1,1)走到(w,h)不经过任何黑点的方案数 思路 考虑容斥 先把所有黑点按照x值进行排序方便计算 \(dp_{i}\)表示从起点走到第 ...