Oracle SQL Tutorial 10 - Whitespace, Case Sensitivity, and Comments

submitted by mkenny400 on 03/23/18 1

SELECT "Hello World" FROM DUAL The first thing you should know about writing queries is that this SQL is not whitespace sensitive. That means we can space this out however we wish. The only requirement is that you do not separate keywords out with spaces. They must be as one entity. Another gotcha is that when you are inside of quotes, whitespace becomes very important. That means if inside of a string you put a character and then 10 spaces, every single one of those spaces is going to part of that string: SELECT "Hello World" FROM DUAL The next thing you should notice is the capitalization. When we type SQL, by convention we capitalize all keywords. I personally really like this because you can easily see the difference between keywords and words that we created or use. But obviously we could capitalize the letters in the quotes. Keep in mind that this is a convention, meaning you do not have to follow this. Oracle is also case insensitive in that SELECT and select both do the same thing. Strings, once again, care about casing. Take this, for example: SELECT 'true' FROM DUALWHERE 'Hello' = 'Hello' And compare the results to this: SELECT 'true' FROM DUALWHERE 'Hello' = 'hello' Only the first one outputs the value true. Once we get into creating database objects such as tables with columns, those are not case sensitive either. That means instead of selecting from DUAL, you can select from DuAl Finally, I shall introduce you to comments. Comments allow you to tell the database engine that you want it to ignore a certain part of your code and not execute it. This is helpful if you want to document your code. It is also useful if you want to have multiple SQL statements open in one tab, but don't want to hover over the one you want to execute. You can comment out the ones you are not using and uncomment them when you are done. Using – will comment out the rest of the line, Using /* */ will comment everything between. This can even be used over multiple lines. But now, let's move onto the important stuff… CREATING TABLES!!!!! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ HELP ME! www.patreon.com/calebcurry Subscribe to my newsletter: eepurl.com/-8qtH Donate!: bit.ly/DonateCTVM2. ~~~~~~~~~~~~~~~Additional Links~~~~~~~~~~~~~~~ More content: CalebCurry.com Facebook: www.facebook.com/CalebTheVideoMaker Google+: plus.google.com/+CalebTheVideoMaker2 Twitter: twitter.com/calebCurry Amazing Web Hosting - www.dreamhost.com/r.cgi?1487063 (The best web hosting for a cheap price!)

Leave a comment

Be the first to comment

Collections with this video
Email
Message
×
Embed video on a website or blog
Width
px
Height
px
×
Join Huzzaz
Start collecting all your favorite videos
×
Log in
Join Huzzaz

facebook login
×
Retrieve username and password
Name
Enter your email address to retrieve your username and password
(Check your spam folder if you don't find it in your inbox)

×