sql - Using ONLY Entity Relationship Diagram to Query MYSQL Format [BRAIN CHALLENGE] -


normally query using tables , schema in case have use entity relationship diagram query on piece of paper in mysql format.

these making things complicated. require example question.

question:

note:

based on data above inner joins written this:

select * wines     inner join carry on wines.wine_id = carry.wine_id 

notice diagram relationship between wines , caries shows 0 many (1..1 - 0..*). notice wine_id not listed in carry table column list implied throught relation.

next want know price today (hint: since table carry table has price_start_date , price_end_date implies prices not fixed , need use these fields):

where price_start_date <= curdate() , curdate() <= price_end_date 

to prices below $15:

where price_start_date <= curdate() , curdate() <= price_end_date     , price_on_carry < 15 

question 1 query below (you need add relevant column names):

select * wines     inner join carry on wines.wine_id = carry.wine_id price_start_date <= curdate() , curdate() <= price_end_date     , price_on_carry < 15     , wines.color = 'red' 

note: english not first language confused "whether or not canada", if need include information whether wine canada or not. assumed don't need include information.


Comments

Popular posts from this blog

wordpress - (T_ENDFOREACH) php error -

Export Excel workseet into txt file using vba - (text and numbers with formulas) -

Using django-mptt to get only the categories that have items -