sqlite数据库 怎么查看所有表名

sqlite数据库 怎么查看所有表名,第1张

sqlite查看所有表名及字段名

查询table,type 段是'table',name段是table的名字, so:

select name from sqlite_master where type='table' order by name

查询indices,type段是'index', name 是index的名字,tbl_name是index所拥有的table的名字

通过以下语句可查询出某个表的所有字段信息

PRAGMA table_info([tablename])

1,

"show

tables"

in

sqlite命令行模式.schema

抓出数据库中所有的表.tables

抓出数据库中所有的表和索引都可以使用LIKE来匹配程序中使用sqlite中的sqlite_master表来查询sqlite_master表结构CREATE

TABLE

sqlite_master

(

type

TEXT,

name

TEXT,

tbl_name

TEXT,

rootpage

INTEGER,

sql

TEXT)查询table,type

段是'table',name段是table的名字,

so:select

name

from

sqlite_master

where

type='table'

order

by

name查询indices,type段是'index',

name

是index的名字,tbl_name是index所拥有的table的名字2."describe

table"两种方法-cursor.execute("PRAGMA

table_info(tablename)")print

cursor.fetchall()--from

sqlite3

import

dbapi2

as

sqlitecur.execute("SELECT

*

FROM

SomeTable")col_name_list

=

[tuple[0]

for

tuple

in

cur.description]


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

原文地址: https://outofmemory.cn/sjk/9974157.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-03
下一篇 2023-05-03

发表评论

登录后才能评论

评论列表(0条)

保存