i got different outputs
hi sir
when I wrote the code with the date in ' ' it gives me an error
and when i removed the ' ' it run only 12 rows , i don't know where's the issue
Hi Mohammed!
Thanks for reaching out.
You can use quotes for both numbers and strings. But usually quotes are for strings. The numbers can be without quotes and in this way there is a better readability. On the other side, dates should be with quotes! If you skip the quotes, the result set will be different and incorrect. Let me show you an example: If you skip the quotes and you have:
... BETWEEN 2000-01-01 AND 1995-05-04...
it will be the same as: .
.. BETWEEN 1986 AND 1998...
(1995-05-04=1995-5-4=1986 and 2000-01-01=2000-1-1=1998) which is very different from:
...BETWEEN '2000-01-01' AND '1995-05-04'...
The first example has a period of 12 years and the second one with only 5 years. Thus, the result set will be different.
Note: So, as a conclusion you used the correct way. So, why the error? It is because you have empty spaces in the date. It should be: '1999-01-01'
.
Hope this helps.
Best,
Tsvetelin