简体   繁体   English

Laraadmin和sqlite“ SHOW”:语法错误(SQL:SHOW TABLES)

[英]Laraadmin and sqlite “SHOW”: syntax error (SQL: SHOW TABLES)

I have installed laraadmin as for quick admin with using sqlite. 我已经安装了laraadmin,以便使用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 但是问题是当我要创建获取SQLSTATE [HY000]的东西时:常规错误:在“ SHOW”附近出现1:语法错误(SQL:SHOW TABLES)谢谢

Unfortunately SQLite doesn't know SHOW TABLES , but instead it has: 不幸的是,SQLite不知道SHOW TABLES ,但是它具有:

special command line commands , like .schema or .tables (with optional LIKE patterns) 特殊的命令行命令 ,例如.schema.tables (带有可选的LIKE模式)

a master metadata table , called sqlite_master 主元数据表 ,称为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: 查询与特定LIKE模式匹配的表名的模式:

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: 查询与特定LIKE模式匹配的表名:

sqlite> .tables A%
A   AB

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 我正在尝试加入 2 个表并希望获取该行(如果它存在)但它向我显示此错误 SQLSTATE[42000]:语法错误或访问冲突:1064 - I am trying to join 2 tables and wanna fetch the row if it exists but it show me this error SQLSTATE[42000]: Syntax error or access violation: 1064 Laravel 中的 Mysql 查询在使用 show 语法时出现语法错误 - Mysql query in laravel gives syntax error while using show syntax 如何使用Laravel LaraAdmin解决安装错误? - How can I resolve installation error with Laravel LaraAdmin? 显示来自 2 个表的数据 laravel 6 - show data from 2 tables laravel 6 Laravel-显示2表的信息 - Laravel - Show information from 2 tables Laravel SQL语法错误 - Laravel Sql syntax error 仅当isAdmin()为true时才显示@ click =“”,而无需重复自己。 获取语​​法错误 - Show @click=“” only if isAdmin() is true without repeating myself. Getting syntax error 显示自定义错误消息 - Show custom error message 在Laravel中显示错误页面? - Show error page in Laravel? 我使用了正确的表,但显示错误SQLSTATE [42000]:语法错误或访问冲突:1103 Laravel 5.1中的表名不正确 - I have use correct table but show the error SQLSTATE[42000]: Syntax error or access violation: 1103 Incorrect table name in Laravel 5.1
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM