Archive for the ‘Databases’ Category

Who Knew? Database Design!

I recently had to think about designing a database for the first time. Now, I have put up tables every-so-often with a few columes to store some things. And I did know how to throw together some Java or PHP so I could interact with those tables. But, now, for my first time ever, I had to design a database. The whole thing. The many tables and connections between them. I had to think about how everything interacts, and how I would modify the data and access it. And I loved this whole process.

What do you think a database is?

I never realized it before, but I had no idea what a database actually was. I don’t know about you, but I always though it was simply a few sets of tables with some columes and a few rows of data that go into it. Maybe scaled up to hold millions of rows of data, but the same idea. I used to think it was as simple as creating a new table with the columes set to what you needed.

After setting up that table (I don’t store passwords, don’t worry) I would just start pushing data into it. I didn’t really think of that as designing anything, or planning anything. Sure, I would think over what kind of data type each field is. And, of course, I would figure out what fields I needed. But I never really planned it out. That’s just what a database was to be.

So what is a database?

A database is a collection of data. A bunch of things that go with other things in certain ways. But that doesn’t help us when we get to the code of it. No. But I think that you need to spend a little more time thinking about your database design. It’s more than just a table of data spat out. It’s how it all relates. It’s how you think about it. And it’s what you plan on doing with it.

Instead of writing out some code, take some time and grab a piece of paper or a whiteboard, and write it all down. Then think about it. There is probably way better ways to do it than just starting with the code (as always).

Plus, if you want to put together a larger database with a bunch of different kinds of data, it may be time to actually design it. Grab that paper, or better yet, some software that’s meant for it. Next you need to think about it. Consider it. Put together all the kinds of things you’re storing and how they relate. Plan it out. Then, after you know exactly what you need and want, you can start writing your code.