|
Comments for: allan20000830
| Message # 1015164: |
|
Date: 01/17/03 03:30
By: Joonas Subject: Bad table structure Although I know that the table in this tutorial is for demonstration purposes only, I have to point out one thing. With the current table structure you could insert duplicate sales entries, which of course would be very bad.. for instance, you could do: INSERT INTO sales VALUES (1,1,'London',325); INSERT INTO sales VALUES (2,1,'London',635); How would you know which one of these is the right amount for the month... A better way to construct the table would of course be using month&team as primary key together. Or you could use unique() on them. My suggestion for the new table: CREATE TABLE sales ( g_month tinyint(4) DEFAULT '0' NOT NULL, g_team tinytext NOT NULL, g_num int(11) DEFAULT '0' NOT NULL, PRIMARY KEY (g_month, g_team) ); |
Previous Message | Next Message |


