|
You've got it down, Snot. And to answer an earlier question you asked, the "proper" way is one table with lots of stuff in it. We could go into detail and talk for days about why that's so, but the main point is its easier this way. If you had a table for each spider, well, you'd need a different way to store the list of all of them, and that would have to tell you which table to use. That's what the database is for - just store everything that's alike in one place.
If you're feeling brave, I have some recommendations. You probably noticed how handy varchar(255) is, but sometimes there's a better way. I think a few of your fields could benefit from it. Let's talk about a few specifics.
You might want to get rid of your humidity column. It's only useful for one thing right now - you can look up a spider, and see what humidity it corresponds to. That's a useful thing, but a database can do even more. Instead, you might use 2 columns, called minHumidity and maxHumidity, both floating point (or some other number with decimal format) types. This way instead of text saying "high 70 to 80 percent" you have numbers that you can do math with. This way, you can have a search function, where I might say "I have a tank at 63 % humidity - what spider can live in it?" Same concept applies to your size column.
Speed, location, and housing, could all benefit from a different idea, called lookup tables. You don't have very many differnet values in those columns, but you have to type and store them in each time. Worse, if you make a typo, every time you run a search, you'll start missing things that were spelled wrong. Instead, you might give size its own table, with an ID column. Small can get 1, and medium 2. Then, in your spider table, you'd have a SizeID column, that's just a number - if it's 1, you know you're dealing with a tiny spider. The benefit there is a narrow table that's faster, but it's also consistant data, no worry about spelling something wrong and not being able to find it.
|