1:查询数据库中所有表名
  select table_name

  from information_schema.tables

  where table_schema='csdb' and table_type='base table';

  table_schema:用于限定数据库名称,此处我用了自建的csdb库,你查用你的,注意:information_schema表示系统库。

  table_type='base table‘:限定只查询基表。

  2:查询指定数据库中指定表的所有字段名column_name
   select column_name

     from information_schema.columns

     where table_schema='csdb' and table_name='users';

  table_schema:用于限定数据库名。

  table_name:用于限定表名。

注意:若查询报1064错误,说明你的某个标点符号有问题

相关文章:

  • 2022-12-23
  • 2022-01-24
  • 2021-11-22
  • 2021-11-03
  • 2021-07-28
  • 2021-07-01
  • 2022-02-08
猜你喜欢
  • 2021-07-23
  • 2021-06-12
  • 2021-07-22
  • 2022-01-04
  • 2021-10-02
  • 2022-02-07
相关资源
相似解决方案