Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Databases SQL Basics Finding the Data You Want Searching Within a Range of Values

Why do we put the date range within parenthesis when we don't put numbers within parenthesis? Is this unique to MySQL?

It feels like you would not want these ranges within parentheses because they are functioning like numbers, and I recall seeing a Postgres script that forced dates into strings when they were placed with parentheses (correct me if I'm wrong). Is this something that is only used with MySQL and is there a reason why we place them for dates here?

Steven Parker
Steven Parker
231,272 Points

Where do you see parentheses used? I didn't see any in the video examples or the teacher's notes.

Steven Parker Maybe it was an answer that I submitted in parenthesis and it was marked correct

3 Answers

Steven Parker
Steven Parker
231,272 Points

Parentheses by themselves don't define a string. But when used for grouping, such as when placed around a string, they don't cause an error even if they are not needed.

Steven Parker
Steven Parker
231,272 Points

I'm sure I don't know the syntax for every database engine that exists, but it's certainly not standard SQL for parentheses to define a string.

But show your exact code and and tell us what database you are using if you need a more accurate answer.

Steven Parker but why would my answer still be correct if I had turned the date into a string by adding parenthesis around it?

Steven Parker is this only with SQLite that parenthesis don't define a string?