Hello,
I'm currently building an eccomerce website involving two tables - one for Products and the other for Plants (the website is for a garden centre). At the moment each item in these tables is uniquely identifed using a Product_ID (although it seems a bit confusing, the plants are also identified using a Product_ID) - which is a unique integer counting up from 0 - and a Category_ID. When I first started building the site the requirement for 2 fields to uniquely identify any given item didn't really bother me as I have to include category IDs in both tables in order to offer search by category facilities, however, it does mean that whenever I want to uniquely identify a data item I have to include parameters for both Product_ID and Category_ID (becuase for each Product_ID in the Plants table there is a Product_ID in the Products table the same as it).
Although at first I didn't think this was a major problem there are a lot of little situations where it's starting to become a pain. In recently started building the shopping cart system and the fact that I have to uniquely identify items using 2 fields is a real pain. Each Plant/Product being sold is also available in numerous sizes, which are stored in a seperate table, however, like with the shopping cart I have to include Product_ID and Category_ID to uniquely identify data items.
Ideally, what I'd like to be able to do is proceed all of the product ID's in the Plants table with the letters "PL" and all of the product ID's in the Products table with "PR". Is there any way of proceding a primary key field set to data type int (unique integer) with these characters? If this isn't possible is there an easier solution to my problem or do all ecommerce websites uniquely identify items stored across different tables using both a Product and Category ID?
I'd be really grateful of any help and advice you can offer me on this one.
Many thanks,
Luke