Imagining a scenario where:
Table1: id (primary key of table 1), id_2, name, CATEGORY (new
field)
Table2: table_id2 (primary key of table 2), id_2 (of table 1),
name, CATEGORY (new field)
A query in these two tables using the category for comparison would look like this:
SELECT *
FROM Tabela1 T1, Tabela2 T2
WHERE T1.id_2 = T2.id_2
AND T1.CATEGORIA = T2.CATEGORIA
You always have to treat the relationships between primary and foreign keys in a SQL query.
But if you remove the foreign key it would look like this:
Table1: id (primary key of table 1), id_2, name, CATEGORY (new
field)
Table2: table_id2 (table 2 primary key), name, CATEGORY
(new field)
SELECT *
FROM Tabela1 T1, Tabela2 T2
WHERE T1.CATEGORIA = T2.CATEGORIA
Just remembering that if the fields allow null values your query would change.
But I think you understood.
Abs.