且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

同时更新和检查

更新时间:2023-11-09 22:24:58

只需查看一下您的数据库设计就会发现一些基本问题:

1。 Total_Amount字段具有重复值,例如2000.如果这个字段仅依赖于CatID,那么它们不应该在一个单独的表中,比如`tbl2`?

2.你怎么知道哪个`Is_Completed`行插入`1`当`Total_Amount` ='Amount_Paying`时?也许它应该被移动到那个单独的表`tbl2`。

3.然后两个表`tbl`和`tbl2`可以链接到CatID字段。

请查看数据库设计简介 [ ^ ]
Just one look at your table reveals some fundamental problems with your database design:
1. The `Total_Amount` field has duplicate values, e.g. 2000. If this field is dependent on CatID only, shouldn't they be in a separate table, say `tbl2`?
2. How do you know which `Is_Completed` row to insert `1` when `Total_Amount` = `Amount_Paying`? May be it should be moved to that separate table `tbl2` too.
3. The two tables `tbl` and `tbl2` can then link through CatID field.
Check this out Introduction to database design[^]