python使用mysql
昨日内容: 一. 外键的变种 (*************) 唯一索引 unique('name') : 此列是不能重复的 联合唯一索引: unique('name', 'age') : 这两列的值不能重复 一对多 department: id depart_name 1 公关部 2 xxx 部 user: id username depart_id (外键的约束) 1 root 1 2 root2 2 3 root3 1 一对一 看业务的需求 user: id username depart_id (外键的约束) 1 root 1 2 root2 2 3 root3 1 blog: id url user_id (唯一 + 外键约束) 1 /root/ 1 2 /root3/ 3 多对多 user: id username 1 root 2 root2 3 root3 host: id hostname 1 c1.com 2 c2.com 3 c3.com user2host: id uid hid (联合唯一 + 外键) 1 1 1 2 1 2 3 3 1 4 3 3 二. 数据行的详细操作 增: insert into t1 (name, age) values ('lxxx', 12); insert into t1 (name, age) values ('lxxx',