The taxpayers through the United State Department of Agriculture Agriculture Research Service, Nutrient Data Laboratory have provided a USDA National Nutrient Database for Standard Reference, Release 24 of foods, food ingredients, and nutrition. The current revision is 24.
If you have the Microsoft Access database software, you can download a pre-made MS Access database which presumably has the relationships and perhaps some sample queries.
If you are a Linux or Unix user, you are left to your own ingenuity to create the database. As I transitioned from SR 23 to SR 24 I thought that I should improve my own documentation to make my life easier next time. Perhaps you will find it useful as well.
I tried the code and found that it needed correction. I believe it works better now.