Login

Welcome, Guest. Please login or register.

November 27, 2025, 11:31:03 am

Author Topic: Foreign Key  (Read 1524 times)  Share 

0 Members and 1 Guest are viewing this topic.

methodsboy

  • Guest
Foreign Key
« on: October 15, 2009, 07:03:35 pm »
0
hey every1, the IT threads have been very quite lately.
does anyone know what a foreign key is? and is it the same as a secondary key?

ell

  • Victorian
  • Forum Leader
  • ****
  • Posts: 801
  • Respect: +18
Re: Foreign Key
« Reply #1 on: October 15, 2009, 07:29:37 pm »
0
A foreign key is a key in a table that references a field from another table.

E.g. let's say a company takes orders, and they have a Customers table and an Orders table - the Orders table may use the CustomerID field from the Customer table to help uniquely identify an order.

It's separate to a secondary key, which is a different concept that I don't think you need to know for VCE IT.

methodsboy

  • Guest
Re: Foreign Key
« Reply #2 on: October 15, 2009, 10:19:17 pm »
0
ohhh..ive used that many times..except i had no idea that that's what it was called. LOL!
thanks

excal

  • VN Security
  • Victorian
  • ATAR Notes Legend
  • *******
  • Posts: 3490
  • Über-Geek
  • Respect: +21
Re: Foreign Key
« Reply #3 on: October 20, 2009, 02:48:31 am »
0
@ ell - I've never heard of the concept of the secondary key before - is it any different from a candidate key?

For those who are interested, a candidate key is a field that would be suitable as a primary key field in a table but, for whatever reason, is not.

(both of these you won't need to know for IT:A)
excal (VCE 05/06) BBIS(IBL) GradCertSc(Statistics) MBBS(Hons) GCertClinUS -- current Master of Medicine candidate
Former Global Moderator

cobby

  • Victorian
  • Part of the furniture
  • *****
  • Posts: 1437
  • Respect: +7
Re: Foreign Key
« Reply #4 on: October 20, 2009, 07:21:47 am »
0
@ ell - I've never heard of the concept of the secondary key before - is it any different from a candidate key?

For those who are interested, a candidate key is a field that would be suitable as a primary key field in a table but, for whatever reason, is not.

(both of these you won't need to know for IT:A)
Do you have an example of where a candidate key may be used Excal?
2008 - Economics
2009 - Maths Methods CAS
          English
          I.T Apps
          P.E

ell

  • Victorian
  • Forum Leader
  • ****
  • Posts: 801
  • Respect: +18
Re: Foreign Key
« Reply #5 on: October 20, 2009, 12:34:57 pm »
0
@ ell - I've never heard of the concept of the secondary key before - is it any different from a candidate key?

From what I understand, there's secondary indexes - simply a secondary way to access records - which either use candidate keys or a "nonkey with duplicate values" (straight from textbook). The secondary indexes that use candidate keys are called secondary keys, so they are the same thing as a candidate key essentially.

@cobby: You'll start to look at candidate keys when you do normalization of relations into the different normal forms, which you'll learn more about at uni if you decide to do IT.

excal

  • VN Security
  • Victorian
  • ATAR Notes Legend
  • *******
  • Posts: 3490
  • Über-Geek
  • Respect: +21
Re: Foreign Key
« Reply #6 on: October 20, 2009, 11:46:15 pm »
0
@ ell - I've never heard of the concept of the secondary key before - is it any different from a candidate key?

For those who are interested, a candidate key is a field that would be suitable as a primary key field in a table but, for whatever reason, is not.

(both of these you won't need to know for IT:A)
Do you have an example of where a candidate key may be used Excal?

Candidate keys are generally not used - they're just used to describe fields that are suitable as primary keys, but are not (very simplified explanation). You won't need to look at this unless you  study IT at university...

A more complicated explanation is here: http://en.wikipedia.org/wiki/Candidate_key

(the term 'tuple' in database theory is pretty much a row / record in practice)
excal (VCE 05/06) BBIS(IBL) GradCertSc(Statistics) MBBS(Hons) GCertClinUS -- current Master of Medicine candidate
Former Global Moderator