Some extra ideas
As a normal rule, if the database can do it for you, let the database do it for you. Databases know the way to deal with knowledge about 453.7 occasions higher than you do. Don’t attempt to do their job.
For those who ever really feel like including fields ending in 1, 2, 3, and so on., don’t. Learn up on normalization.
Use the right knowledge kind for a column. Don’t use a quantity for a boolean or a string for a date.
Strongly think about including CreatedAt
and UpdatedAt
timestamp fields to each desk. You’ll be shocked at how usually you find yourself being glad that you simply did. Automate these timestamps with triggers, and they’ll turn out to be helpful and painless.
Parameterized saved procedures are your pals. Use them as a lot as you may.
Your question analyzer is an order of magnitude higher at deciding what’s one of the simplest ways to question knowledge than you might be.
Watch out for booleans. Null turns booleans into quantum states—neither true nor false till somebody runs a question. Don’t use a boolean until you realize precisely what null means in that context.
Don’t rely upon string values to outline state. Use an enumerated worth as a substitute, guaranteeing that the information isn’t flawed. Don’t let standing="bananna"
trigger an error as a result of somebody fat-fingered a area.
I’ve left you with a number of dos and don’ts right here. Once more, a very powerful takeaway is to choose a algorithm and implement them ruthlessly. Do this at the moment, and also you’ll save your self many complications down the highway. Future you’ll thanks, consider me.