Im bulding a new Data Model Diagram for my project and im having troubles creating a Many to Many relation.
I´ve posted a screenshot of the diagram specificly on the part that need work.
Here is the screenshot:
http://clip2net.com/s/1K1EH (Please, let me know if the image is no longer avaliable)
In the image you´ll notice 3 tables: produtoloja, produtopedido, pedido,
produtoloja -> Hold information of products
produtopedido -> Makes the relation between produtoloja and pedido
pedido -> Holds information about the order of the product
Tables information:
Table produtoloja:
Primary Keys:
- ProdutolojaId
Indexes:
- (ProdutoId, LojaId) ->NON-UNIQUE
- ProdutoLojaId -> UNIQUE
Table produtopedido
Primary Keys:
- (ProdutoLojaId,PedidoId)
Indexes:
- ProdutoLojaId -> NON-UNIQUE
Foreign Keys:
[Name]fk_produtopedido_pedido_1:
- [Fields] PedidoId
- [Reference Table] pedido
- [Reference Fields] PedidoId
[Name]fk_produtopedido_produtoloja_1:
- [Fields] ProdutoLojaId
- [Reference Table] produtoloja
- [Reference Fields] ProdutoLojaId
Table pedido
Primary Keys:
- PedidoId
Indexes:
- PedidoId -> UNIQUE
- LojaId -> NON-UNIQUE
As you can see in the screenshot, Navicat is accusing an invalid relation between these tables. So my question is, what am i doing wrong? Are my primary keys and indexes ok? What can i do to improve this?
Any help would be appreciated! Thanks in advance!