zoukankan      html  css  js  c++  java
  • sqlite 3基本使用方法

    1、sqlite数据库数据类型

      Integer      整型

      varchar(10)    字符数组

      float       浮点型

      double      双精度浮点型

      char(10)      字符型

      text        文本型

    2、sql语法

    2.1 创建表语句

      create table 表名(字段名称 数据类型 约束,字段名称 数据类型 约束......)

      create table person(id Integer primary key,name varchar(10),age Integer not null)

    2.2 删除表的语句

      drop table 表名

      drop table person

    2.3 插入数据

      insert into 表名(字段,字段) values(值1,值2)

      insert into person(id,age) values(1,20)

      insert into person values(2,"qwe",30)-->如果没有指定字段名称,则values中的值必须从表结构中第一个字段开始依次赋值

    2.4 修改数据

      update 表名 set 字段=新值 where 修改的条件

      update person set name=“ls” where id=1

      note:不添加where表明修改表中所有的字段,修改多个字段可以用,隔开

      update person set name=“ls”,age=20 where id=1

    2.5 删除数据

      delete from 表明 where 删除的条件

      delete from person where id=2

    2.6 查询数据

      select 字段名 from 表明 where 查询条件 group by 分组的字段 having 筛选条件 order by 排序字段

      select * from person;               查询表person中所有的数据

      select id,name from person;            查询表person中字段为id和name 的数据

      select * from person where id=1          查询表person中id=1的数据 

      select * from person where id=1 and age>18    查询表person中id=1和age大于18的数据

  • 相关阅读:
    less中遇到的一些特殊的写法
    观察者模式
    发布订阅模式
    javascript中的函数
    关于js中this的理解和作用
    [Oracle]Oracle镜像安装及使用教程
    log4net日志配置
    过滤器
    .net core 处理 中文乱码
    Fromform
  • 原文地址:https://www.cnblogs.com/Malphite/p/8323892.html
Copyright © 2011-2022 走看看