MySQL Forums
Forum List  »  Newbie

Re: help with tables design
Posted by: Rick James
Date: March 02, 2015 05:50PM

SELECT * FROM Cars WHERE made_year IN (2000, 2003, 2010);

Having a Years table is what I call "over-normalization".

Or... Perhaps you are looking for which models were made in all of those three years? That is more complex:
SELECT make, model, COUNT(DISTINCT made_year) as ct FROM Cars
WHERE made_year IN (2000, 2003, 2010)
HAVING ct = 3;

Options: ReplyQuote


Subject
Written By
Posted
February 28, 2015 10:11PM
March 02, 2015 06:14AM
Re: help with tables design
March 02, 2015 05:50PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.