0

Hello, I was wondering how i would create the Units table for this. Would i just set both Unit_ID and Customer_ID in the Units table as foreign keys or do i need to have a primary key like Customer_Unit_ID then have the two foreign keys?

Customers
Customer_ID Customer_Full_Name Contact_Name Address_1 Address_2 City Postal_Code State Phone Email
1
2
3
4
5
6
7
8
9
10
Customers_Units
Unit_ID Customer_ID
1 3
2 3
3 3
4 7
5 7
6 8
7 9
8 10
9 10
10 10
Units
Unit_ID Unit_Serial Number Stock_Receive_Date Scan_Out_Date
1
2
3
4
5
6
7
8
9
10

2
Contributors
2
Replies
7
Views
4 Years
Discussion Span
Last Post by brandon66
1

if you want to join the Customers_Units to another table, then a PK can be useful. Also InnoDB creates one anyway, just that you won't have access to it if you don't declare it. PKs can be composite - i.e. more than one field. Each record in your link table needs to be unique, so why not have a PK?

Edited by diafol

0

Alright ill add the primary key so later i can use it with another table if i have to. Thanks!

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.