考虑这些简单的表格:
id primary-key, auto-increment
name varchar(256)
+---------+
- tasks -
+-------------------------------------------+
- id | name -
+-------------------------------------------+
- 1 | Go to supermarket -
- 2 | Buy cheese -
- 3 | Buy PS4 and not Xbone -
+-------------------------------------------+
id primary-key, auto-increment
username unique varchar(128)
+---------+
- users -
+-------------------------------------------+
- id | username -
+-------------------------------------------+
- 1 | dalejr -
- 2 | firstnamelastname -
+-------------------------------------------+
user_id fk, index
task_id fk, index
+---------------+
- users_tasks -
+-------------------------------------------+
- user_id | task_id -
+-------------------------------------------+
- 1 | 1 -
- 1 | 2 -
- 2 | 3 -
+-------------------------------------------+
tablename.tablename_id
是愚蠢的。这种做法与既定的MySQL惯例/最佳做法有何不同?
更重要的是, ......是不是很糟糕?