Solutions

EspaƱol

T04.001- All the information of orders previous to October 2010

select * from orrder where date < '2010-10-01';


T04.002- All the information of orders later than August 2010.

select * from orrder where date > '2010-08-31';


T04.003- All the information of orders between August and October 2010.

select * from orrder where date > '2010-07-31' and date < '2010-11-01';
Alternative:
select * from orrder where date between '2010-08-01' and '2010-10-30';


T04.004- All the information of orders requested 3rd March or 27th October 2010

select * from orrder where date = '2010-03-03' or date = '2010-10-27';


T04.005- Which is the date of today and the time?

select now();


T04.006- Codes of articles requested in 2010, avoiding duplicates and ascending sorted.

select distinct article
from linorder l, orrder p
where l.numOrder=p.numOrder 
  and year(date)=2010  
order by article;
Alternative:
select distinct article
from linorder l, orrder p
where l.numOrder=p.numOrder 
  and date between '2010-01-01' and '2010-12-31'  
order by article;


T04.007- Codes of articles requested in March 2010, avoiding duplicates and ascending sorted.

select distinct article
from linorder l, orrder p
where l.numOrder=p.numOrder 
  and month(date)=3 and year(date)=2010  
order by article;
Alternative:
select distinct article
from linorder l, orrder p
where l.numOrder=p.numOrder 
  and date between '2010-03-01' and '2010-03-31'  
order by article;


T04.008- All data of UUSERs born in March of any year.

select * from uuser where month(nacido)=3