美文网首页
2021-04-03 sqlite 用法

2021-04-03 sqlite 用法

作者: netppp | 来源:发表于2021-04-03 21:38 被阅读0次

    打开CMD窗口

    C:\Users\yuanerde>cd    C:\Program Files\Python37\sqlite3  进入sqlite文件夹

    C:\Program Files\Python37\sqlite3>sqlite3.exe               进入 操作模式

    SQLite version 3.35.4 2021-04-02 15:20:15

    Enter ".help" for usage hints.

    Connected to a transient in-memory database.

    Use ".open FILENAME" to reopen on a persistent database.

    sqlite> .databases

    main: "" r/w

    sqlite> .open data.db             打data数据库

    sqlite> .databases

    main: C:\Program Files\Python37\sqlite3\data.db r/w

    sqlite> .tables

    aa

    sqlite> select * from aa;

    7|f

    x|8

    sqlite> .headers on               这个开关可以让aa表显示数据时。把列名(比如m ,n )显示出来

    sqlite> select * from aa;

    m|n

    7|f

    x|8

    sqlite>

    --------------------------------------------

    打开CMD窗口

    C:\Users\yuanerde>cd    C:\Program Files\Python37\sqlite3  进入sqlite文件夹

    C:\Program Files\Python37\sqlite3>sqlite3.exe               进入 操作模式

    SQLite version 3.35.4 2021-04-02 15:20:15

    Enter ".help" for usage hints.

    Connected to a transient in-memory database.

    Use ".open FILENAME" to reopen on a persistent database.

    sqlite> .open data.db             打data数据库

    sqlite> .tables            查询数据库里有哪些表

    sqlite> create table aa (m,n);           创建一个aa的表 ,两列为m ,n

    sqlite> select * from aa;              显示一下表aa的数据,为空

    sqlite> insert into aa  values (7,'f');             给表aa的两列插入数据

    sqlite> select * from aa;                         显示一下表aa的数据

    m          n

    ----------  --------------------

    7          f

    sqlite> insert into aa  values ('x','8');             给表aa的两列插入数据

    sqlite> select * from aa;           显示一下表aa的数据

    m          n

    ----------  --------------------

    7          f

    x          8

    sqlite>

    相关文章

      网友评论

          本文标题:2021-04-03 sqlite 用法

          本文链接:https://www.haomeiwen.com/subject/fpahkltx.html