P
PJFry
I am working on database normalization and I have a theoretical question.
I have a table with 1000 records and two fields. Let's call it tOrders. The
first field, OrderID is the primary key. The second field, Location, can be
one of four options, TW, FF, EQ or SN. Like so:
pkOrderID txtLocation
10001 TW
10002 TW
10003 FF
10004 SN
10005 SN
10006 EQ
To propery normalize this, I would create a second table, tLocation with
four records and a primary key to identify those. Something like this:
pkID txtLocation
1 TW
2 FF
3 EQ
4 SN
Now how do I relate them? Would the table with the OrderID look like this:
OrderID lngLocation
10001 1
10002 1
10003 2
10004 4
10005 4
10006 3
with a join on tLocation.pkID = tOrders.lngLocation?
I have a table with 1000 records and two fields. Let's call it tOrders. The
first field, OrderID is the primary key. The second field, Location, can be
one of four options, TW, FF, EQ or SN. Like so:
pkOrderID txtLocation
10001 TW
10002 TW
10003 FF
10004 SN
10005 SN
10006 EQ
To propery normalize this, I would create a second table, tLocation with
four records and a primary key to identify those. Something like this:
pkID txtLocation
1 TW
2 FF
3 EQ
4 SN
Now how do I relate them? Would the table with the OrderID look like this:
OrderID lngLocation
10001 1
10002 1
10003 2
10004 4
10005 4
10006 3
with a join on tLocation.pkID = tOrders.lngLocation?