You have two tables named Salesperson and Sales. You need to ensure that each record in the Sales table has a valid associated salesperson record in the Salesperson table. Which database object should you add to the Sales table?
I believe the answer is Foreign Key.
Each salesman in the parent SalesPerson table may have 0,1 or more sales in the Sales table (child table). To ensure that each sale is related to a record in the SalesPerson table, a foreign key reference would be created in Sales. I assume the Primary Key in Sales would be something such as an InvoiceNumber and the Primary Key in SalesPerson would be SalemanID.
I believe that the correct answer is Foreign Key. A foreign key is a key used to link two tables together. This is sometimes also called a referencing key. A Foreign Key is a column or a combination of columns whose values match a Primary Key in a different table.
Primary Key on Sales. If we had Primary Key on Persons and Foreign on Sales, we would not ne in the First Normal Form, because one salesperson would have 'repeated groups' that is multiple salesIDs in the person record. So our main table is Sales that has a Primary Key (ie SalesID), in which we can have also a Foreign Key indicating a singular sale person from persons table. But Persons would be auxiliary table serving Sales, not other way round.
Correct answer is C - foreign key.
Via Wikipedia: A foreign key is a set of attributes in a table that refers to the primary key of another table. The foreign key links these two tables.
They have asked what should you add to sales table so the answer is PRIMARY KEY. If they had asked what needs to be added to SalesPerson table then the answer would have been Foreign Key.
A voting comment increases the vote count for the chosen answer by one.
Upvoting a comment with a selected answer will also increase the vote count towards that answer by one.
So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.
cdc
Highly Voted 5 years, 6 months agoHuyNgo
Highly Voted 5 years, 1 month agodim37
Most Recent 1 year, 3 months agodzoni68
2 years, 6 months agomco2l
2 years, 8 months agoemka_ka
2 years, 9 months agoJonny98101
2 years, 9 months agoTogueTagno
2 years, 10 months agoPETBOZ
2 years, 10 months agodefcon1
3 years agoEshaM
3 years, 3 months agoEshaM
3 years, 3 months agoqaqa111
3 years, 8 months agoMirela_Rona
3 years, 9 months agoJudetheobscure
3 years, 10 months agoCertMeUp
4 years, 2 months agobulat
4 years, 3 months agoJovial
4 years, 6 months ago