I have two tables (A and B) and I want each record in these tables to have an unique ID (id_C). How do I do that?
TABLE_A:
id_A | id_C
1 1
2 3
TABLE_B:
id_B | id_C
1 2
2 4
PS. I was thinking about something like this:
create table c(
id_c int not null auto_increment,
PRIMARY KEY(id_c)
);
create table a(
id_a int not null auto_increment,
a_c int not null,
PRIMARY KEY(id_a),
FOREIGN KEY (a_c) REFERENCES c(id_c)
);
create table b(
id_b int not null auto_increment,
b_c int not null,
PRIMARY KEY(id_b),
FOREIGN KEY (b_c) REFERENCES c(id_c)
);