mercredi 2 décembre 2015

Need senior help to verify my understanding about Surrogate key in relational database design

I would like to know if my understanding about Surrogate key is correct or not.

E.g:

Below is my example database design

Customers Table

| id(PK) |  Name   |    Age       |   
|  1     |  John   |  34          |
|  2     |  Doe    |  30          | 

QrCodes Table
| id(PK) |  QRcode | Tracking No. | CustomerID (FK)
|  1     |  QR123  |  TR901111    |   1
|  2     |  QR345  |  TR902222    |   2


Redemptions Table
| id(PK) | Name          | Tracking No. | CustomerID(FK)
|  1     |  Redemption 1 |   TR901111   |  1
|  2     |  Redemption 2 |   TR902222   |  2
|  3     |  Rdemption  3 |   TR902222   |  2

As you can see,I have two Tracking No. column,one for qrcodes table & one for redemptions table. So then I can have a query like find all Qrcodes & redemptions by tracking no only.

Is the Tracking No. column can be classify as Surrogate key? or I have wrong at all. That is my question.

Thanks for your time.

Aucun commentaire:

Enregistrer un commentaire