Sample Data for Nuts and Bolts Thread Series
. I'm trying to determine the Primary Key(s) for this data set. Here is a sample of a few valid combinations.
size form tpi
1/4 UNC 20
1/4 UNF 28
1/4 UNEF 32
5/16 UNC 18
5/16 UN 20
5/16 UNF 24
5/16 UN 28
5/16 UNEF 32
3/8 UNC 16
3/8 UN 20
3/4 UNC 10
Ultimately I'm trying to build pull down menus in a web app which allows the user to select a valid bolt such as 3/4-10UNC-2A HEX Head.
A 3/4-6UNC-2A HEX Head
is not valid because they don't manufacture a 3/4" bolt with 6 threads per inch (it wouldn't be loaded in this table).
The first pull down selects the bolt type, the second pull down provides bolt sizes that are available based on the bolt type (defined in another db table)
The third pull down would offer the final portion of the bolt definition. So if a user selects HEX Head, then 5/16" they would see choices for UNC-18, UN-20, UNF-24, UN-28, and UNEF-32.
My options for PK(s) could be:
- surrogate and create unique constraints.
- use size and form as composite PK, which determines tpi
- use size and tpi as composite PK, which determines form
- use form and tpi as PK, which determines size
- all three fields as PK (probably wrong!)
It seems like it doesn't matter which PK option I choose in regards to the query because I would be querying based on bolt diameter to get the other two values. Something I left out is the 2A values, which relate to the UN Forms in another table, and a "doozey" of a requirement that further limits which ThreadSeries can be used with a bolt type.
I'm doing this in Java EE, using JSF, and JPA Entities if that matters