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

Olga Ivancic
Olga Ivancic
8,137 Points

Double or single quotes? And What is the difference between INTEGER and INT?

After watching a video I have two things that were not clear to me:

  1. IS there a difference using double or single quotes while working with a STRING data type? Chris used single quotes while Andrew in his SQL Basics course used double quotes.

  2. What is the difference between INTEGER and INT data types? And why the second one included amount of digits in parenthesis?

Please see below.

Olga Ivancic
Olga Ivancic
8,137 Points

Hey, Shari, thank you for the answer. I can't accept it though unless you post it down below in the "Add an answer" section.

2 Answers

Hi Olga!

To answer Question 1, you can use either in a string, you need to be consistent, though. If you start off using single quotes then you need to use single quotes throughout the string. Keep in mind, there may be instances where you will need to use both in a string, it all depends on the code you are writing. The important thing to know it to keep it consistent, but you can use either.

As for Question 2, I'm learning myself, so I Googled it.:

The following are the differences: - Integer is a wrapper class, where as int is a primitive data type. - Integer can be used as an argument to a method which requires an object, where as int can be used as an argument to a method which requires an integer value, that can be used for arithmetic expression.

Wrapper classes are used to convert any data type into an object.

Hope this helps.

In an effort to be articulate and thorough with my answer, I forgot to mention, please don't forget about developer resources like MDN and W3C.