I have 2 tables books, mobiles in a Mysql database.
Tables structure being,
1. book_id|book_name
2. mobile_id|mobile_name
A third table products with the following structure is also created,
- product_id|product_name
Now, I want the book_id to start with a pattern in mysql.
For example,
book_ids -> 11,12,13,14,15,16,17,18,19,110,111,112,...
mobile_ids -> 21,22,23,24,25,26,27,28,29,210,211,212,...
Now, in my products table I can have,
product_id -> 11,21,16,26, if this starts with pattern is not set,
then the problem would be,
product_id -> 1,1,6,6..its not unique.
How to handle this..?
Edited stuff below:
So, are you meaning this..?
category_table
category_id | category_name
1 | books
2 | mobiles
book_table
book_id | book_name
1 | da vinci code
2 | alchemist
mobile_table
mobile_id | mobile_name
1 | nokia
2 | samsung
product_table
id | product_name | product_id | category_id
1 | da vinci code | 1 | 1
2 | alchemist | 2 | 1
3 | nokia | 1 | 2
4 | samsuing | 2 | 2
You seem to be duplicating information without a reason.
Just create a products table with: