问题
I have installed laraadmin as for quick admin with using sqlite. But problem is when i am going to create something getting SQLSTATE[HY000]: General error: 1 near "SHOW": syntax error (SQL: SHOW TABLES) Thanks
回答1:
Unfortunately SQLite doesn't know SHOW TABLES
, but instead it has:
special command line commands, like .schema
or .tables
(with optional LIKE
patterns)
a master metadata table, called sqlite_master
So let's say you have the following tables:
sqlite> CREATE TABLE A(a INT, b, INT, c TEXT);
sqlite> CREATE TABLE B(a INT);
sqlite> CREATE TABLE AB(a TEXT, b TEXT);
You can query the schema:
sqlite> .schema
CREATE TABLE A(a INT, b, INT, c TEXT);
CREATE TABLE B(a INT);
CREATE TABLE AB(a TEXT, b TEXT);
Query the table names:
sqlite> .tables
A AB B
Query all the metadata:
sqlite> SELECT * FROM sqlite_master WHERE type = 'table';
table|A|A|2|CREATE TABLE A(a INT, b, INT, c TEXT)
table|B|B|3|CREATE TABLE B(a INT)
table|AB|AB|4|CREATE TABLE AB(a TEXT, b TEXT)
Query the schema of table names matching a specific LIKE
pattern:
sqlite> .schema A%
CREATE TABLE A(a INT, b, INT, c TEXT);
CREATE TABLE AB(a TEXT, b TEXT);
Query the table names matching a specific LIKE
pattern:
sqlite> .tables A%
A AB
来源:https://stackoverflow.com/questions/53724862/laraadmin-and-sqlite-show-syntax-error-sql-show-tables