Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
select country, city from table;

Suppose we have multiple cities and one country. If we have defined one field that would store the countries and the child stores the cities, using without pk, we would have one value for the country and one value for the city.

This query can be changed to:

Code Block
titleUse Primary Key
select country, city, id as pk from table;

Then the parent should have a list of countries(same name), but with different ids and the child field can have one of the cities associated to that country.