Demography: Answers

Demography: Answer 1

Show, for everybody, how many siblings he (she) has.

Links between tables

Diagram for database Demography question 1

SQL query

The "brother or sister" gender will be determined by the "gender" attribute for individuals who act as siblings of the reference individual. We can see, in the result of the query, that the individual number 1 has two sisters (sex F) and that the individual number 7 has one brother (sex H) and one sister (sex F).

(Back to questions)

Demography: Answer 2

Display, for each individual, the name of his grandparents, on the father's side. 

Links between tables

Diagram for database Demography question 2

SQL query

(Back to questions)

Demography: Answer 3

Show the average age of women when they marry.

Links between tables

Diagram for database Demography question 3

SQL query

(Back to questions)

Demography: Answer 4

Display the name of the children (and the number of individuals) whose parents do not have the same nationality.

Links between tables

Diagram for database Demography question 4

SQL query

(Back to questions)

Demography: Answer 5

Display families (father's name and mother's name) with more than 2 children.

Links between tables

Diagram for database Demography question 5

SQL query

(Back to questions)

Demography: Answer 6

Show the rank (elder, second child)... of the person with a number equal to 11.

Links between tables

Diagram for database Demography question 6

SQL query

(Back to questions)