下面为您介绍的SQL语句可以取得MySQL表信息、外键关系等重要信息,有着很好的使用价值,如果您在MySQL表信息方面遇到过类似的问题,不妨一看。
创新互联成都企业网站建设服务,提供成都网站建设、成都做网站网站开发,网站定制,建网站,网站搭建,网站设计,成都响应式网站建设公司,网页设计师打造企业风格网站,提供周到的售前咨询和贴心的售后服务。欢迎咨询做网站需要多少钱:028-86922220
- /*取得表信息*/
- select table_Comment as Script, table_Name as TableName, 0 as id, Create_Time as createDate,
- CASE table_Type WHEN 'BASE TABLE' then 'U' when 'VIEW' then 'V' ELSE table_Type END as tableType,
- 0 as Category from tables;
- /*取得外键关系*/
- SELECT CONSTRAINT_Name as Script, CONSTRAINT_Name as TableName, 0 as id,
- CURRENT_TIMESTAMP as createDate,
- CASE CONSTRAINT_TYPE
- WHEN 'FOREIGN KEY' THEN 'F'
- WHEN 'PRIMARY KEY' THEN 'K'
- ELSE CONSTRAINT_TYPE
- END AS tableType, 0 as Category From TABLE_CONSTRAINTS;
- SELECT Table_Name, Column_Name, Column_Type, Column_Key, Column_Comment From Columns ;
- /*取得列信息*/
- select table_name as tablename, column_Name as columnName, column_type as columnType,
- 0 as columntypeindex, CHARACTER_OCTET_LENGTH as length, Numeric_Precision as decimaldigits,
- column_comment as Script,column_default as defaultvalue, is_nullable as isnullable,
- case extra when 'auto_increment' then 1 else 0 end as IsMarking,
- 0 as colid, 'U' as ObjectType, data_type from columns;
以上就是取得MySQL表信息的语句写法。
当前题目:取得MySQL表信息的语句
本文链接:http://www.shufengxianlan.com/qtweb/news27/114627.html
网站建设、网络推广公司-创新互联,是专注品牌与效果的网站制作,网络营销seo公司;服务项目有等
声明:本网站发布的内容(图片、视频和文字)以用户投稿、用户转载内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-86922220;邮箱:631063699@qq.com。内容未经允许不得转载,或转载时需注明来源: 创新互联