如何 *** 作sqlite数据库

如何 *** 作sqlite数据库,第1张

概述安装Django的时候会自动把sqlite数据库安装上,下面介绍如何 *** 作sqlite数据库: 1 进入你创建的目录,在终端运行 sqlite3 DBname.db 2 进入后输入.help可以查看帮助文档 3 .tables 可以要看sqlite3中有哪些表 select * from tablename; 查看数据 具体 *** 作命令: [root@10 src]# cd rietveld[roo

安装Django的时候会自动把sqlite数据库安装上,下面介绍如何 *** 作sqlite数据库:

1 进入你创建的目录,在终端运行 sqlite3 DBname.db

2 进入后输入.help可以查看帮助文档

3 .tables 可以要看sqlite3中有哪些表

select * from tablename; 查看数据

具体 *** 作命令:

[root@10 src]# cd rIEtveld[root@10 rIEtveld]# lsapache.conf.example      dev.db        Makefile   README           settings.pyc  Todo       upload.py.origcoderevIEw               __init__.py   manage.py  rIEtveld_helper  static        UPDATEScoderevIEw.wsgi.example  __init__.pyc  patches    settings.py      templates     upload.py[root@10 rIEtveld]# sqlite3 dev.dbsqlite version 3.6.20Enter ".help" for instructionsEnter sql statements terminated with a ";"sqlite> .tablesauth_group                      coderevIEw_issue              auth_group_permissions          coderevIEw_message            auth_message                    coderevIEw_patch              auth_permission                 coderevIEw_patchset           auth_user                       coderevIEw_repository         auth_user_groups                django_admin_log              auth_user_user_permissions      django_content_type           coderevIEw_account              django_session                coderevIEw_branch               django_site                   coderevIEw_bucket               gae2django_reftestmodel       coderevIEw_comment              gae2django_regressiontestmodelcoderevIEw_content            sqlite> select * from auth_user;1|root|||root@root.com|sha1$dac64$c7c81d89f0ff8f8cedefc95ad59a3849cf705f12|1|1|1|2012-09-20 23:43:39.161264|2012-09-20 03:54:33.2572312|tao.lu|||tao.lu@autonvai.com|sha1$fff77b4c631f4a6bf2b216dab658d853b3ef98d81906|0|1|0|2012-09-20 22:21:14|2012-09-20 22:20:56sqlite> .help.backup ?DB? file      Backup DB (default "main") to file.bail ON|OFF           Stop after hitting an error.  Default OFF.databases             List names and files of attached databases.dump ?table? ...      Dump the database in an sql text format                         If table specifIEd,only dump tables matching                         liKE pattern table..echo ON|OFF           Turn command echo on or off.exit                  Exit this program.explain ON|OFF        Turn output mode suitable for EXPLAIN on or off..genfkey ?OPTIONS?     Options are:                         --no-drop: Do not drop old fkey triggers.                         --ignore-errors: Ignore tables with fkey errors                         --exec: Execute generated sql immediately                       See file tool/genfkey.README in the source                        distribution for further information..header(s) ON|OFF      Turn display of headers on or off.help                  Show this message.import file table     import data from file into table.indices ?table?       Show names of all indices                         If table specifIEd,only show indices for tables                         matching liKE pattern table..load file ?ENTRY?     Load an extension library.mode MODE ?table?     Set output mode where MODE is one of:                         csv      Comma-separated values                         column   left-aligned columns.  (See .wIDth)                         HTML     HTML <table> code                         insert   sql insert statements for table                         line     One value per line                         List     Values delimited by .separator string                         tabs     Tab-separated values                         tcl      TCL List elements.nullvalue STRING      Print STRING in place of NulL values.output filename       Send output to filename.output stdout         Send output to the screen.prompt MAIN CONTINUE  Replace the standard prompts.quit                  Exit this program.read filename         Execute sql in filename.restore ?DB? file     Restore content of DB (default "main") from file.schema ?table?        Show the CREATE statements                         If table specifIEd,only show tables matching                         liKE pattern table..separator STRING      Change separator used by output mode and .import.show                  Show the current values for varIoUs settings.tables ?table?        List names of tables                         If table specifIEd,only List tables matching                         liKE pattern table..timeout MS            Try opening locked tables for MS milliseconds.wIDth NUM NUM ...     Set column wIDths for "column" mode.timer ON|OFF          Turn the cpu timer measurement on or offsqlite> 
总结

以上是内存溢出为你收集整理的如何 *** 作sqlite数据库全部内容,希望文章能够帮你解决如何 *** 作sqlite数据库所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/sjk/1175140.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-06-02
下一篇 2022-06-02

发表评论

登录后才能评论

评论列表(0条)

保存