mysql怎么看表属主 mysql怎么看主从

怎么看MYSQL表的主键在phpmyadmin里面点开一张表然后看哪个字段下面有下划线那个就是主键,或者看下面的索引这一栏没有没有一个字段类型是PRIMARY那就是主键
mysql怎么查看表结构和注释MySQL 查看表结构简单命令 。
一、简单描述表结构mysql怎么看表属主,字段类型desc tabl_name;
显示表结构mysql怎么看表属主,字段类型mysql怎么看表属主 , 主键 , 是否为空等属性,但不显示外键 。
二、查询表中列的注释信息
select * from information_schema.columns where table_schema = 'db'#表所在数据库
and table_name = 'tablename' ; #mysql怎么看表属主你要查的表
三、只查询列名和注释
selectcolumn_name,
column_comment from information_schema.columns where table_schema ='db'and
table_name = 'tablename' ;
四、#查看表的注释
select table_name,table_comment from information_schema.tableswhere table_schema = 'db' and table_name ='tablename'
psmysql怎么看表属主:二~四是在元数据表中查看,我在实际操作中,常常不灵光,不知为什么,有了解的大侠请留印 。
五、查看表生成的DDLshow create table table_name;
mysql 如何判断一个表是主表还是从表--books表中有字段有bId , pId等字段 。
--another有bId,pId等字段(create table another select bId,pid,bAuthor from books;--相关字段以及内容来自books表) 。
--books和publising建立外键,参照publishing中的id字段 。
alter table books add constraint FK_books_publishing foreign key (pid) references publishing (id) on update cascade;
--another和publishing之间创建外键,参照publishing中的id字段 。
alter table another add constraint FK_another_publishing foreign key (pId) references publishing (id) on update cascade;
--举个简单的更新列子:
update publishing set id = 17,pname = '爱好者' where id='14';
--当执行这条语句时(更新publishing表) , books表和another表同时进行更新 。
--主表更新字段数据等,副表也随之更新 , 从上面可以看出,主表是publishing,副表是books和another 。
--希望能帮到你
【mysql怎么看表属主 mysql怎么看主从】mysql怎么看表属主的介绍就聊到这里吧,感谢你花时间阅读本站内容 , 更多关于mysql怎么看主从、mysql怎么看表属主的信息别忘了在本站进行查找喔 。

    推荐阅读