zoukankan      html  css  js  c++  java
  • mysql中获取表名&字段名的查询语句

      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错误,说明你的某个标点符号有问题

  • 相关阅读:
    初识计算机
    前端html css
    mysql高级
    mysql多表查询
    mysql数据库查询
    mysql表关系
    mysql数据类型
    mysql数据库介绍
    异步回调 协程
    GIL-全局解释器锁
  • 原文地址:https://www.cnblogs.com/zja001/p/10050246.html
Copyright © 2011-2022 走看看