Database - Representation of relations between classes

0

Good day! I have two classes, one called City

public class City {
private string name;
private int population;
private Country country;
}

and another call Country

public class  Country {
 private string name;
 private List<City> cities;
}

It is not very clear to me how to represent that relationship of the classes in the DER. I made a table called City that has as fields: Id, Name, Population, IdCountry. and a Country call that has: Id, Name.

It seems to me that Country is very 'empty', but I also think that with the id of country as FK of the City table, you can raise all the Cities that belong to that country and build the list!

The question is whether I am right or relationships are not represented in this way. Thanks!

    
asked by Maria Laura 11.12.2017 в 15:09
source

0 answers