Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/sql/87.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
用序列号列出mysql中的所有表_Mysql_Sql - Fatal编程技术网

用序列号列出mysql中的所有表

用序列号列出mysql中的所有表,mysql,sql,Mysql,Sql,我想用序列号列出数据库中的所有表,类似这样 +-------+---------------------------------------+ | sl_no | table_name | +-------+---------------------------------------+ | 0 | aaaaccadminprofile | | 0 | aaaaccbadloginstat

我想用序列号列出数据库中的所有表,类似这样

+-------+---------------------------------------+
| sl_no | table_name                            |
+-------+---------------------------------------+
|     0 | aaaaccadminprofile                    |
|     0 | aaaaccbadloginstatus                  |
|     0 | aaaacchttpsession                     |
|     0 | aaaaccoldpassword                     |
|     0 | aaaaccount                            |
|     0 | aaaaccountowner                       |
|     0 | aaaaccountstatus                      |
|     0 | aaaaccownerprofile                    |
|     0 | aaaaccpassword                        |
|     0 | aaaaccsession                         |
|     0 | aaaaccsessionaudit                    |
|     0 | aaaaccsessionprop                     |
|     0 | aaaaccuserprofile                     |
我试过这个密码

select @a:=0 as sl_no, table_name from information_schema.tables where table_schema = 'eventlog';
但我不知道在哪里增加值,它只显示0。添加(@a:=@a+1)显示错误。 有人能帮帮我吗。

你可以试试下面的-

set @a=0;
select (@a:=@a + 1) as sl_no, table_name 
   from information_schema.tables
where table_schema = 'eventlog';

您使用了
:(@MatBailie,谢谢您,先生-修改了答案