I have hold a long believe that, if you are a student and there is a topic or concept you are finding so difficult to understand, no matter how hard you’ve tried, then, you have not met the right teacher or the right book.
Let me give you a typical example:
I spent 3 years at Kpoly without knowing the difference between Primary Key and Candidate key.
Anyone who is into database will know what this means.
I read several articles and referenced books from the Kpoly library, still…. I do not understand.
“I do not understand” does not mean if you ask me
What is Primary Key, or what is Candidate Key, I will not be able to tell you something.
I cant write a definition for you and you will mark me 100% correct. Bud deep down me, I know I do not clearly understand what I am saying…. I was just vomiting textbook definitions, so that I can pass my exams and forget.
After completion, one of the days, my mentor (Ghost) called me.
“Tanii, let’s go to Book Trust”.
Fast forward, we got there.
Ghost had an insider then so he is notified anytime new books come in. This is important if not you will not get any good or new book when you go there. These are the “Books for Africa” types. Most of them are old books and do not cover current technologies, in terms of Computer Science or IT in general.
Occasionally, there will be few good books in it but you must be an early catcher or you want get it. Because many institutions and individuals come there as soon as new books come in.
We got there and so lucky, there were many boxes there unopened.
So we joined them to open it.
We really got nice nice books. And for mine, one was a database management system book – a big textbook.
My national service at Atebubu, I sent it.
One evening, I decided to go that candidate and primary key thing.
It just was a paragraph somewhere in there, that I read, and got my “Buddha moment.”
And I was like, “Ah, is that all?”
Wrobbish.
Guess what?
They are the same.
Candidate Key and Primary Key are the same thing.
WTF!
So why do they have different name and why do books and articles online try so hard to show difference?
I dont know.
But this is what that textbook said (not exactly but along a scenario like this):
“Assuming all your Unique keys are in a competition. The winner (Champion) is the Primary key and any other person that competed is a Candidate Key.. They are called Candidate Keys because they are candidates in the competition. In the case of database design, all your unique keys are candidate keys and what the developer finally settles on because of his personal interest or some other reasons best known to him, becomes your Primary Key”.
Now, to say that in Twi:
Assuming you have an excel data of all the NPP Delegates in Dormaa East. You want to give them small Xmas package
Name
Gender
Age
MobileNo
Ghana Card No
VoterIDNo
NPP Party ID number
PollingStatationCode
XmasPackageAmount
Let’s say you have 500 delegates.
Now, which of these pieces of information do you think will be unique to individuals? Which of these pieces of information do you think two or more people WILL NOT use same?
Can two or more people have the same name?
Can two or more people have same gender?
Can two or more people have same Ghana Card Number?
Can two or more people have same Mobile number?
Can two or more people have same VoterID number?
Can two or more people have same NPP Party Id number?
Can two or more people have same Polling Station Code?
Clearly, everyone and their Voter ID number. Everyone and their Mobile number, everyone and their party ID, and everyone and their Ghana Card number. No two people can have any of these. At least in theory.
The rest are not unique.
Two or more people can have the same name. If you go to Zongo, if the person is not Issifu he is Salifu. So Salifu or Issifu or any other “fu” is not unique to one person.
Two or more people can have the same gender too,
and Two or more people can vote at the same polling station, so they will have the same polling station code on their voter card.
So, in the context of database design, we will say that
Ghana Card, Mobile Number, NPP Card No, and Voter ID numbers are unique – No two people have the same.
So, if I came for my xmas package and you search for my mobile number in the excel sheet, you will find me and give me my package.
If you search for my Ghana card number, you will find me and give me my package. If you search for my NPP Card no, you will find me and give me my package, and same with Voter ID number.
But here is the thing:
Is every delegate having Ghana card?
Is every delegate having Mobile Number?
Is every delegate having voter id?
Is every delegate having NPP Card?
Not every delete in Ghana has a Ghana Card. So though Ghana card is unique to everyone, not every delegate has it.
So what happens when you decide to focus on Ghana Card and someone comes without it?
What about Mobile number? Is every delegate having it?
What about voter ID and Npp card?
We can fairly assume that every delegate has Mobile Number, Voter ID and NPP Card.
And by extension, we can confidently say anyone coming for xmas package, will DEFINITELY have ALL of these three IDs (Mobile number, Voter ID, NPP Card).
But if we have to be very specific. If we are pushed to the wall to pick one so that that will be the first ID we will check, what ID will that be?
Well, I think being NPP delegate, your NPP Card is the most important.
Base on that, we declare: “Hello Distributors, make sure you check their NPP Card first! before any other card”.
In the context of database (relational) design.
NPP Card is the number 1. In order words, NPP Card is the Primary Key (Column).
But dont forget, Mobile Number and Voter ID number could have been used too. We just picked NPP Card because we are dealing with NPP delegates.
In the context of the earlier “competition” I talked about…..
Mobile Number, Voter ID and NPP Card all qualify to be considered as primary. So they are all called Candidate keys. And the final one (NPP Card) that we settled on, becomes our Winner (Primary Key) out of the candidate keys.
Since I got this understanding from that textbook way back 2012. I have never forgotten it. And I have never thought of finding the definition again.
But anytime there is the need to explain it, I Am able to do it.
If there is something you are not getting, keep searching, you will hit your “Buddha Moment”.
That could be through a book or through a teacher