Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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
218,813 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
218,813 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
218,813 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?