Sqlite   发布时间:2022-05-22  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了SQLite3查询表结构大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

运行sqlite3 sHell程序:

C:\>sqlite3_3_5.exe

sqlite version 3.3.5

Enter ".Help" for instructions

建表AuditData:

sqlite> create table AuditDate (time TEXT,Operatetype integer,Usernametext,EncrypteBox_Srcdisk text,EncrypteBox_Src@R_558_4687@t,EncrypteBox_SrcPath text,EncrypteBox_SrcEx text,EncrypteBox_Desdisk text,EncrypteBox_Des@R_558_4687@t,EncrypteBox_DesPath text,EncrypteBox_Desex text,file@R_558_4687@t,fileSrcPath text,fileDesPath text,fileExplain text);

查询表AuditDate的内容:

sqlite> select * from auditDate

...> ;

查询当前数据库下的所有表名称:

sqlite> .table

AuditDate

使用sql语句查询表结构信息:

sqlite> SELEct * from sqlite_master where type = "table";

table|AuditDate|AuditDate|2|create table AuditDate (time TEXT,username text,fileExplain text)


查看sqlite3帮助命令:
sqlite> .Help
.databases List names and files of attached databases
.dump ?table? ... Dump the database in an sql text format
.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.
.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 on table
.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
.scheR_624_11845@a ?table? Show the CREATE statements
.separator StriNG Change separator used by output mode and .import
.show Show the current values for varIoUs setTings
.tables ?PATTERN? List names of tables matching a liKE pattern
.timeout MS Try opening locked tables for MS milliseconds

.wIDth NUM NUM ... Set column wIDths for "column" mode

退出sqlite3:

sqlite> .quit

启动sqlite3,创建1.db,并连接到该数据库:

C:\>sqlite3_3_5.exe 1.db
sqlite version 3.3.5

Enter ".Help" for instructions

将表结构输出:

sqlite> .dump
BEGIN transaCTION;
create table AuditDate (time TEXT,fileExplain text);
COMMIT;

将AuditDate表的表结构输出:

sqlite> .dump AuditDate
BEGIN transaCTION;
create table AuditDate (time TEXT,En
crypteBox_Srcdisk text,
EncrypteBox_SrcEx text,Encrypt
eBox_DesPath text,fileDesP
ath text,fileExplain text);
COMMIT;

将查询结果输出到文件1.txt:

sqlite> .output 1.txt

将查询结果输出到屏幕:

sqlite> .output stdout
sqlite> SELEct * from sqlite_master where type = "table";
table|AuditDate|AuditDate|2|create table AuditDate (time TEXT,Encrypte
Box_SrcPath text,F

ileSrcPath text,fileExplain text)

建表adb,并且向其中插入数据,然后查询该表中字段的数据类型:

sqlite>create table adb (@R_558_4687@t)
sqlite> SELEct typeof(Name) from adb;
sqlite> insert into adb (Name) values ('ddd');
sqlite> SELEct typeof(Name) from adb;
text
sqlite>



查看整个数据库的表结构

sqlite> .scheR_624_11845@a
create table a (time Integer not null default CURRENT_TIMESTAMP,@R_558_4687@t);
create table ab (time Integer,@R_558_4687@t);
create table abc (@R_558_4687@t,time Integer not null default CURRENT_TIMESTAMP);
create table abcd (@R_558_4687@t,time Integer not null default CURRENT_TIMESTAMP);
create table abcde (@R_558_4687@t,time Integer );

显示表头:

sqlite> .head on
sqlite> select * from abcde;
name|time
aaa|
sqlite>

查看当前sqlite3运行时的配置信息:

sqlite> .show echo: off explain: off headers: on mode: List nullvalue: "" output: stdout separator: "|" wIDth: sqlite>

大佬总结

以上是大佬教程为你收集整理的SQLite3查询表结构全部内容,希望文章能够帮你解决SQLite3查询表结构所遇到的程序开发问题。

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

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。
标签:EncrypteB