As opposed to writing out business querying objects, and working through them in SQL. Tonight I spent time creating objects on my virtual machine, as well as my native machine. I worked on creating a database that had a few different tables in it, and had a compound primary key on one of the tables. When I started looking into these things (especially the second piece) I came across a blog that I thought was interesting because it discussed the use of ssn#'s as primary keys, and whether or not it was a good idea. The overall answer was no, that it was not a good idea to use them as PK's.
For the database that I'm creating (contacts in my phone book) I want to use the phone number as the primary key, but not all of these are unique because they can be assigned to multiple "people"... therefore I began looking at the idea of a composite primary key. I would likely have to add the phone number and firstname as the composite key... anyways, I'm working on it. It's fun play around with this stuff in SQL, as I have in Synergex in the past. The phone numbers are currently stored as VARCHAR(12), it'll be fun to removing the "-" from the phone numbers (if they exist), and casting them into an integer.
Once I have my DB setup, I'll want to be able to link up to it from my current cpu instead of the virtual one I currently am working on. If anyone is reading this, I encourage you to do the same thing, as it proves valuable in navigating SQL, not just TSQL.
No comments:
Post a Comment