3 Incorporated comment
source | link

In "OK", I mean "it doesn't have any bad impact with the overall database design".

  • For example, will it cause insertion problems?
  • or will it be a problem in the future when I add field in the table?

For example, I have a simple database with three tables:

  • Customer(CustomerID, CustomerName)
  • Product(ProductID, ProductName)
  • Order(OrderID, CustomerID, ProductID)

It is clear that the Order table is only a mapping between the two tables (Customer and Product). The OrderID in table Order has no use, it is there only to identify each row.

How about if I don't want to identify each row because for example we have the rule:

A user can't order the same product twice.

Off course it is far from reality but it is only an example.

The bottom line question is, in the example given above, is it OK to remove the OrderID in the table Order and setting both ProductID and CustomerID from table Order as composite primary key? In this case, the Order table only contains foreign key and is set as composite primary key.

As a beginner, I have searched a lot about database design concepts and found some terms like "primary key", "composite primary key", "database normalization" etc. but I don't know what will happen in practice so I decided to ask here. I am just worried about its future implications because I don't know if there is a particular circumstance that it will be a disadvantage.

In "OK", I mean "it doesn't have any bad impact with the overall database design".

  • For example, will it cause insertion problems?
  • or will it be a problem in the future when I add field in the table?

For example, I have a simple database with three tables:

  • Customer(CustomerID, CustomerName)
  • Product(ProductID, ProductName)
  • Order(OrderID, CustomerID, ProductID)

It is clear that the Order table is only a mapping between the two tables (Customer and Product). The OrderID in table Order has no use, it is there only to identify each row.

How about if I don't want to identify each row because for example we have the rule:

A user can't order the same product twice.

Off course it is far from reality but it is only an example.

The bottom line question is, in the example given above, is it OK to remove the OrderID in the table Order and setting both ProductID and CustomerID from table Order as composite primary key? In this case, the Order table only contains foreign key and is set as composite primary key.

In "OK", I mean "it doesn't have any bad impact with the overall database design".

  • For example, will it cause insertion problems?
  • or will it be a problem in the future when I add field in the table?

For example, I have a simple database with three tables:

  • Customer(CustomerID, CustomerName)
  • Product(ProductID, ProductName)
  • Order(OrderID, CustomerID, ProductID)

It is clear that the Order table is only a mapping between the two tables (Customer and Product). The OrderID in table Order has no use, it is there only to identify each row.

How about if I don't want to identify each row because for example we have the rule:

A user can't order the same product twice.

Off course it is far from reality but it is only an example.

The bottom line question is, in the example given above, is it OK to remove the OrderID in the table Order and setting both ProductID and CustomerID from table Order as composite primary key? In this case, the Order table only contains foreign key and is set as composite primary key.

As a beginner, I have searched a lot about database design concepts and found some terms like "primary key", "composite primary key", "database normalization" etc. but I don't know what will happen in practice so I decided to ask here. I am just worried about its future implications because I don't know if there is a particular circumstance that it will be a disadvantage.

2 improve formating, fix typo.
source | link

In "OK", iI mean "it doesn't have any bad impact with the overall database design". For example, will it cause insertion problems? or will it be a problem in the future when I add field in the table?

  • For example, will it cause insertion problems?
  • or will it be a problem in the future when I add field in the table?

For example, I have a simple database with three tables: Customer(CustomerID, CustomerName), Product(ProductID, ProductName), Order(OrderID, CustomerID, ProductID).

  • Customer(CustomerID, CustomerName)
  • Product(ProductID, ProductName)
  • Order(OrderID, CustomerID, ProductID)

It is clear that the Order table is only a mapping between the two tables  (Customer and Product). The OrderID in table Order has no use, it is there only to identify each row. 

How about if I don't want to identify each row because for example we have the rule: "a user can't order the same product twice".

A user can't order the same product twice.

Off course it is far from reality but it is only an example.

The bottom line question is, in the example given above, is it OK to remove the OrderID in the table Order and setting both ProductID and CustomerID from table Order as composite primary key? In this case, the Order table only contains foreign key and is set as composite primary key.

I am really sorry if I didn't express myself clearly, I am not a native English speaker. If you have something to clarify, please don't hesitate to ask. Thank you for reading my NOVEL... :)

In "OK", i mean "it doesn't have any bad impact with the overall database design". For example, will it cause insertion problems? or will it be a problem in the future when I add field in the table?

For example, I have a simple database with three tables: Customer(CustomerID, CustomerName), Product(ProductID, ProductName), Order(OrderID, CustomerID, ProductID). It is clear that the Order table is only a mapping between the two tables(Customer and Product). The OrderID in table Order has no use, it is there only to identify each row. How about if I don't want to identify each row because for example we have the rule: "a user can't order the same product twice". Off course it is far from reality but it is only an example.

The bottom line question is, in the example given above, is it OK to remove the OrderID in the table Order and setting both ProductID and CustomerID from table Order as composite primary key? In this case, the Order table only contains foreign key and is set as composite primary key.

I am really sorry if I didn't express myself clearly, I am not a native English speaker. If you have something to clarify, please don't hesitate to ask. Thank you for reading my NOVEL... :)

In "OK", I mean "it doesn't have any bad impact with the overall database design".

  • For example, will it cause insertion problems?
  • or will it be a problem in the future when I add field in the table?

For example, I have a simple database with three tables:

  • Customer(CustomerID, CustomerName)
  • Product(ProductID, ProductName)
  • Order(OrderID, CustomerID, ProductID)

It is clear that the Order table is only a mapping between the two tables  (Customer and Product). The OrderID in table Order has no use, it is there only to identify each row. 

How about if I don't want to identify each row because for example we have the rule:

A user can't order the same product twice.

Off course it is far from reality but it is only an example.

The bottom line question is, in the example given above, is it OK to remove the OrderID in the table Order and setting both ProductID and CustomerID from table Order as composite primary key? In this case, the Order table only contains foreign key and is set as composite primary key.

1
source | link

Is it "OK" to have a table that only contain foreign keys?

In "OK", i mean "it doesn't have any bad impact with the overall database design". For example, will it cause insertion problems? or will it be a problem in the future when I add field in the table?

For example, I have a simple database with three tables: Customer(CustomerID, CustomerName), Product(ProductID, ProductName), Order(OrderID, CustomerID, ProductID). It is clear that the Order table is only a mapping between the two tables(Customer and Product). The OrderID in table Order has no use, it is there only to identify each row. How about if I don't want to identify each row because for example we have the rule: "a user can't order the same product twice". Off course it is far from reality but it is only an example.

The bottom line question is, in the example given above, is it OK to remove the OrderID in the table Order and setting both ProductID and CustomerID from table Order as composite primary key? In this case, the Order table only contains foreign key and is set as composite primary key.

I am really sorry if I didn't express myself clearly, I am not a native English speaker. If you have something to clarify, please don't hesitate to ask. Thank you for reading my NOVEL... :)