user_drug.user_id is constrained by Foreign Key drug.id (which is a Primary Key).
Table structure is as follows:
user
id name income
1 Foo 10000
2 Bar 20000
3 Baz 30000
drug
id name
0 Marijuana
1 Cocaine
2 Heroin
user_drug
user_id drug_id
1 1
1 2
2 1
2 3
3 3
Are there any drawbacks to starting drug.id at 0? I have a feeling that that will make things more natural with PHP since arrays also start at 0, but I want to make sure there aren’t any drawbacks with using ‘0’ for an id (e.g. it might be interpreted as null or some other strange potential occurrence/conflict).
If its an AUTO INCREMENT col, zero is a special value which shouldnt be used, but this can be overcome. If its a foreign key and non AUTO INCREMENT, any value is OK. Zero will not be interpreted as anything other than a zero if your column definition is correct (null values appear as NULL, which is distinct from zero)