嗨, 大家好: 网站在新年后正式开通,欢迎大家加入我们,共同维护一个良好氛围的中国技术社区。 欢迎举报不良帖子,欢迎提供建议。
我们的QQ群:136102234,欢迎进群找答案,里边会有很多资深的大师们。 point overflow

mysql5.5之后innodb大肆加强!!

而innodb又是索引组织架构,一个定义好的主键是必备!能大大提高查询效率。

所以应该如何查询没有主键的表呢?

asked 2016-03-02 10:06:46

jkant's gravatar image

jkant ♦♦
11135138139
accept rate: 3%


0.0~

正好用到,整理出来:

select table_name, sum(if(column_key='pri',1,0)) as column_key

from information_schema.columns

where TABLE_SCHEMA in('databse_name')

group by table_name

having column_key=0

link

answered 2016-03-02 10:10:00

admin's gravatar image

admin
11345
accept rate: 100%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "Title")
  • image?![alt text](/path/img.jpg "Title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×72
×1
×1

Asked: 2016-03-02 10:06:46

Seen: 1,545 times

Last updated: 2016-03-02 10:10:00