Database Design – Importance of Designing the Database Correctly from the Beginning

database-design

I'm a beginner web developer and I use MySQL and sometimes MS SQL Server. However, I don't have that much information about databases, just basic information to be able to build some tables.

Now, what if my site grows and I improved my skills one day in databases and I found that I want to re design my database, will be that possible without affecting the way my application works or without losing any data?

Best Answer

Possible? Probably. Realistic? Probably not depending on what "without affecting the way my application works" means to you.

As with anything else, if you build a piece of software on shaky foundations, it's likely that if you decide that you need to re-engineer some component down the road, it will be relatively painful and will likely involve changes to other places in your application. If you build your application with a language or framework that needs to be changed out in the future, you'll likely need to make changes to the way the application works. If you build an application that doesn't scale, going in to improve performance later will be more difficult will likely involve substantial changes throughout the code base. If you build an application on a database that isn't properly designed, re-designing it, converting all the data, and propagating the changes to the application will be time consuming.

That doesn't, of course, mean that you shouldn't build anything until you're an expert in everything. A large part of becoming an expert is making mistakes and learning from them. If your site gets popular enough and you learn enough about databases to conclude that your initial data model was flawed and that it is worth reworking the entire data model, that probably implies that you've been quite successful and that having to work on a "version 2 architecture" is a good problem to have. On the other hand, it's very likely worth picking up a book on basic data modeling reading up a bit on normalization as you design your data model to hopefully avoid the most easily avoided pitfalls.