SELECT table_name FROM information_schema.tablesWHERE table_schema = 'tbs' AND table_name LIKE '%_lib' > 1064 - You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '= 'tbs' AND table_name LIKE '%_lib'' at line 4 > 时间: 0.273s
时间: 2023-12-26 17:06:03 浏览: 29
看起来是SQL语句出现了语法错误。请尝试使用以下SQL语句:
```
SELECT table_name
FROM information_schema.tables
WHERE table_schema = 'tbs' AND table_name LIKE '%\_lib';
```
在这个SQL语句中,我们使用了转义字符"\"来转义下划线"_",避免它被解释为SQL通配符。这应该可以解决上述错误。如果还有问题,请再告诉我。
相关问题
SELECT table_name FROM information_schema.tablesWHERE table_schema = 'tbs' AND table_name LIKE '%\_lib' > 1064 - You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '= 'tbs' AND table_name LIKE '%\_lib'' at line 1 > 时间: 0.076s
看起来还是有语法错误,错误提示指向了第1行。请尝试在FROM和WHERE之间添加一个空格,使用以下修正后的SQL语句:
```
SELECT table_name
FROM information_schema.tables
WHERE table_schema = 'tbs' AND table_name LIKE '%\_lib';
```
这个SQL语句应该可以正确地搜索所有后缀为"_lib"的表。如果还有问题,请让我知道。
分析一下如下语句是什么意思 select column_name from information_schema.tables where table_schema=database()
这是一条MySQL数据库的查询语句,意思是从information_schema库的tables表中选择column_name列,并且满足table_schema等于当前数据库的名称。其中,database()是MySQL内置函数,返回当前数据库的名称。因此,这个查询语句的目的是获取当前数据库中所有表的列名。