SQL query for return of date

-4

I can not solve this DB exercise.

Ask to use the sql date function. We have the date in day / month / year format, we have to extract the month. We have the seller table containing codvend, namevend and dt_nasc.

Question: List all sellers who celebrate their birthday between January and June by returning the name of the month.

Please, if anyone can help me, I'll be very grateful. Thank you.

    
asked by anonymous 13.11.2014 / 14:32

1 answer

2

List all sellers who celebrate their birthday between January and June by returning the name of the month. (Edit the table and field name according to your current table)

SELECT id_vendedor, nome_vendedor, MONTHNAME(dt_nascimento) as MesAniversario 
FROM vendedor WHERE MONTH(dt_nascimento) BETWEEN 1 AND 6;

Reference: link

    
13.11.2014 / 18:34