「SQLite3」sqlite_masterでテーブルスキーマを取得
環境
Windows10 64bit
SQLite3.37.0
書式
select * from sqlite_master;
select * from sqlite_master where type =’table’
and name =’xx’;
使用例1
sqlite_masterテーブルからスキーマを確認します
sqlite> .mode line sqlite> select * from sqlite_master; type = table name = user tbl_name = user rootpage = 2 sql = CREATE TABLE user(uid,uname) type = table name = usertbl tbl_name = usertbl rootpage = 3 sql = CREATE TABLE usertbl(uid, pwd) type = table name = depbl tbl_name = depbl rootpage = 4 sql = CREATE TABLE depbl(depid integer, pwd text)
使用例2
特定のテーブルの構造を確認します
sqlite> select * from sqlite_master where type='table' and name='depbl'; type = table name = depbl tbl_name = depbl rootpage = 4 sql = CREATE TABLE depbl(depid integer, pwd text)