When you start out working on your first query or designing your first table it is important to start out correctly and in good order. Trust me, this will save many headaches down the road.
There are a few things you should consider when starting out. Listed below are a few ideas to get you on the right track at the beginning:
1. Design your tables carefully with a Naming system – Preparing your tables well at the start will save you a lot of headaches later on. Consider a naming system to keep throughout all of your columns. This will help your layout remain clear and clean.
2. Keep queries to a minimum – Building up a lot of queries will mean accumulating more work and possibly slowing down your server. Although this isn’t always possible it is something to keep in mind.
3. Use the Join command – This is a very useful tool to know and use. Joining tables can help you to link tables together allowing each table to be maintained separately. Rather than having a member of staff enter a gigantic database when they just need to reach one area.
4. Develop a CAPTCHA system and validate data – This will help filter out any spam when receiving web visitor information, plus with enough validation it will help you to receive clean data, minimizing headaches later on.
5. Avoid “SELECT*” – Using “SELECT*” will slow down your SQL queries, as it will increase the amount of data SQL has to transfer. Try selecting only the specific columns you need.
6. More Tables – Using more tables rather than adding more columns will help to keep your data clean, easier to expand, avoid duplication, and easier to maintain. In some cases it also allows more flexibility, although bear in mind you will need more joins.