Re: difrent id in a relational DB?? how?
> i want the id for shop 1 to be form 1 to 5 and for shop 2 if i have there 3 customers the id should be from 1 to 3
What purpose would that serve? Primary keys have just one function: uniquely identify the rows they're in. It's a design mistake to load them down with other significance.
shops( shopID int unsigned primary key, ...)
customer( custID int unsigned primary key, ...)
products( prodID int unsigned primary key,
shopID int unsigned,
custID int unsigned,
foreign key(shopID) references shops(shopID),
foreign key(custID) references shops(custID)
)
Subject
Views
Written By
Posted
1828
January 30, 2015 08:28AM
Re: difrent id in a relational DB?? how?
1036
January 30, 2015 10:02AM
913
February 02, 2015 02:22AM
992
February 03, 2015 07:39AM
1068
February 03, 2015 10:54AM
990
February 08, 2015 04:13PM
1020
February 08, 2015 05:53PM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.