HomeНаука и техникаRelated VideosMore From: Caleb Curry

Oracle SQL Tutorial 33 - NUMBER Data Type

121 ratings | 6936 views
This video we are going to discuss the NUMBER data type. The Number data type is used to store integers, and real numbers. When you create a column as a NUMBER, you can store pretty huge or pretty small numbers in this column. Now there are two things you need to consider when working with numbers, and that is the precision as well as the how big the number is. For example, we can store the number 9.9. This has two significant digits. We could also store the number 9.9 X 10^4. In this situation, the number is much larger, but the number of significant digits is the same. 9.9 are the significant digits. When we expand this out we just have 99000, and the zeros are just used for size and are not considered "significant" in this situation. In fact, you get a max precision of 38, but a maximum value of 9.99 * 10^125. You can also use this data type to store very small numbers. Check the docs for the specifics on maximums and minimums. You can provide it with two pieces of information: Precision - The total number of digits. Scale - The number of digits to the right of the decimal. You do it in this format: NUMBER (precision, scale). The important thing to remember in this is that when you specify a precision, you will be limiting the max size of the numbers. The secret behind this data type is that it is actually stored in scientific notation. That is we store a number and then we can multiply it by 10 raised to some power. This allows us to store much larger numbers without taking up a ton of space. The oracle docs actually gives a formula that you can use to see how much storage is going to be required for a specific NUMBER data type. How much precision can be used? The acceptable range is 1-38. What about scale? The range is actually -84 to 127. I'll explain the scale in more detail in an upcoming video. That's because there is a lot of confusing things here…What does it mean for the scale to be negative? How can we have a scale that is bigger that the total number of digits available through the precision. That's a topic for another video. It's important to understand that when we increase our scale, we decrease the max size of the number. For example if we have a precision of 5 and a scale of 3, the highest number we can store is 99.999. This is in contrast to a precision of 5 and a scale of 2 which allows for up to 99.999. Either way you get 5 significant digits, but the numbers of digits to the left and right of the decimal change. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Support me! http://www.patreon.com/calebcurry Subscribe to my newsletter: http://bit.ly/JoinCCNewsletter Donate!: http://bit.ly/DonateCTVM2. ~~~~~~~~~~~~~~~Additional Links~~~~~~~~~~~~~~~ More content: http://CalebCurry.com Facebook: http://www.facebook.com/CalebTheVideoMaker Google+: https://plus.google.com/+CalebTheVideoMaker2 Twitter: http://twitter.com/calebCurry Amazing Web Hosting - http://bit.ly/ccbluehost (The best web hosting for a cheap price!)
Html code for embedding videos on your blog
Text Comments (17)
Chaimae Bel (3 days ago)
Woowwwwww , YOu're Great ,& funny too , Thank you
Kamran Memmedli (24 days ago)
:((( the end , i did not learn useful things except database foundations, pls make more
Manasseh Ntow (1 month ago)
caleb is just awesome and funny
Jessica Ntim-Ofosu (2 months ago)
your videos are great caleb!!!!
Adnan Ashraf (4 months ago)
I think precision and scale are not defined correctly....in above example it should be like number(7.2)... Please correct me if I am wrong.
Maroš Mihalik (4 months ago)
You are a fucking star. Cheers mate for making amazing tutorials.
Leigh Radmore (4 months ago)
Caleb, this series has been a great help to me starting a new role and learning a new language. You have a great way of teaching the subject and I've been engaged the whole way through. I hope you are well and that there are more videos to come on the subject.
eddy nguyen (4 months ago)
If you just define a column as NUMBER without giving it a length, what would be the default? Thanks and keep up the great work. Really enjoyed your vdos.
Autistic Geek (5 months ago)
HAIRCUT!
robinson moses (9 months ago)
Hey Caleb! You are a genius... I'm anticipating your next Oracle SQL Series 34...
Atiqullah Bayat (11 months ago)
Hi Caleb, Please don't ever stop uploading those videos! They are super helpful. I watched the whole series in the past 3 days. and the Oracle tutorial has 33 videos?
DavoStory (1 year ago)
Thanks for these videos, Caleb!
Binruo LYU (1 year ago)
Amazing Caleb :)
TheHerbert4321 (1 year ago)
Made it to here and am a lot smarter now. Thanks for the great videos. Your way of explaining/teaching is easy to understand and very entertaining as well.
Ken Nickson (1 year ago)
hey your tutorials are so amazing.....do you have any android tutorial
Cedric Fromm (1 year ago)
Please dont ever stop uploading those videos! They are super helpful. I watched the whole series in the past 3 days.
Caleb Curry (1 year ago)
Awesome!! More videos will be coming out in the future for this series, but I'm just not sure when yet... thanks for watching! :)

Would you like to comment?

Join YouTube for a free account, or sign in if you are already a member.