Question:
HOW TO CREATE MORE THAN ONE RECORD IN ACCESS 2007 WITH THE SAME PRIMARE KEY?
deepaksindolia
2010-12-09 22:56:12 UTC
Suppose u create a record in access, Access apply a primary key to that record, but what can u do when u require to add another record with same primary key. Later how we see the both records ?
Six answers:
BlueFeather
2010-12-10 04:43:03 UTC
What others have NOT told you might be the solution to your problem.



It is true that a Primary Key field can contain only unique values. However, a Primary Key can be composed of more than one field. In that case, one of the participating fields CAN contain duplicate values, and the Primary Key itself will still be unique.



For example, in a database for filling customer orders, you might have a CUSTOMER table where the Primary Key consists of only one field (cust_id), an ORDER table whose Primary Key is composed of two fields (cust_id, order_no), and an ITEM table whose Primary Key is composed of three fields (cust_id, order_id, item_id).



In the ORDER table, cust_id is called a foreign key. It can have the same value as a record in the CUSTOMER table while values in the order_no field MUST be unique.



In the ITEM table, cust_id and order_no are foreign keys and both can have the same values as a record in the ORDER table but values in the item_id field MUST be unique.



The tables would, of course, have these One-To-Many relationships:



CUSTOMER-->ORDER and ORDER-->ITEM

(one-side on the left, many-side on the right)
?
2010-12-10 07:06:13 UTC
Foreign keys

A foreign key, simply stated, is another table's primary key. The values in a foreign key field match values in the primary key, indicating that the two records are related — for example, a customer and an order that she has placed. Unlike primary keys:



A table can have more than one foreign key.

A foreign key does not necessarily have unique values.

A foreign key cannot reliably identify a particular record. For example, you cannot always tell which record you are viewing from the Orders table by looking at the Customer ID.

You create a foreign key when you use the Lookup Wizard to create a field.



TKN
anonymous
2010-12-10 07:00:43 UTC
The table which has the Primary key column cannot contain duplicate entries. The purpose of Primary Key is to serve the uniqueness of the record and you cannot do it that way.
Wajahat Karim
2010-12-10 07:15:10 UTC
in any type of database, whether u are using MS Access or SQL, you every record will have an unique identifier to make it unique record..... so that unique record is called Primary Key....



so answer to ur question is that u cannot create more than one record with same primary key....



i hope you got what u were looking for.....
balaji
2010-12-10 07:32:40 UTC
primary key concept is to avoid repeated values and keep unique values, if you want to store the repeated value then remove the primary key from that column and set it in another column
anonymous
2010-12-10 07:00:14 UTC
You need to get your database concepts correct.



.


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...