We started with a lecture in this class, which was good since most people probably had no idea why a database was interesting, and why they shouldn’t be using a spreadsheet. To be perfectly honest though, I’m sure a lot of people still don’t know. Though, thinking about it, most people seemed to understand some of the SQL so maybe I’m just under estimating them.
Reasons why you shouldn’t use a spreadsheet to store data:
- It’s too easy to repeat data. For instance in a database you could just say “this row belongs to user 85″, and then have one row describing user 85, like their name and such. However, in a spreadsheet, unless you wanted to look up user 85 every time they were mentioned, you’d have to write out their name potentially hundreds of times. And then what if they change their name? You’ll have to go through and at least write a macro to rewrite all the names, where in a table you’d just need to change the user table once.
- Spreadsheets take up a lot of space, due to the repeat data, and also due to most the cells being in the wrong, or bad, format so compression is harder. For instance, in a database we could just say that a telephone number is capped at eleven characters. The file system now only needs to give that field that many bytes of data. Whereas in a spreadsheet it’d have to be variable length, a much greater resource intensive method.
- They’re not as accessible. Over a network the user would need to download the spreadsheet then make any amendments they want, and then uploading it. They’d also need to lock the file so no one else could even read the data whilst it was in use. With a database, it’d stay on a central server where anyone can access the data at the same time. The database server could better manage user collisions.
- Sticking with that example, a spreadsheet would require tenfold more bandwidth.
That’s enough examples.
After that we just jumped into learning terminology. That’ll probably the hardest thing for me to learn. Since I’m mostly self-taught I’ve rarely had to refer to much to anyone other than myself. For instance, my tutor refers to fields as “attributes”, which is what I could have called it’s type (she calls that the “attribute type”).
As she explained the term “key field” I got a little annoyed. I think she made it sound as though primary keys and unique keys were interchangeable words for the same thing, which they’re just not. Primary keys tell the database that it’s a unique field which is safe to refer to the row as. Whilst that’s the same for a unique field, unique keys aren’t usually used as foreign keys.
During the tutorial we had an example database, which a few tables. As a class (which is good, since most people were new at it, they might be unsure about what exactly the should be doing) we answered a few questions where we had to decide which tables we needed to select to get the information we wanted. Like, “list the students first names”. That was simple enough, so the WHERE clause was introduced. “List the first names of the students who were studying computing”.
As we were working through the lab workbook, I was pretty happy that people sitting close to me felt comfortable enough to ask me if they were stuck. The main problem I think for most people was that they didn’t understand that you need to tell the computer exactly what you want. When the problem asked to return all the students’ addresses, two people that asked me for help got it wrong because they had tried to called the table name `address` when they needed `street` and `town`. I’m pretty sure that’s just a thing they’ll get used to though.
In this class we’re going to be assessed on our ability to write SQL statements, I think. At least at the moment. I’m not sure how advanced we’re going to go into it though. So far it’s just SELECT we’re using, with WHERE, OR/AND, and comparison statements on single tables. Look through the lab work book, I saw that later we’ll be joining tables too. I think I saw a COUNT in there too, so I hope we’ll be using more complex SQL functions. I’ve never had much need to use them before.