Amazon interview question

data modelling and sql queries