Big SQL Energy Beginner Course: Lesson 7 Arithmetic Operators
Got BDE?âĄď¸
Hi BDEs! Welcome to Lesson 7 of the free Big SQL Energy Beginner CourseâĄď¸ Today weâre learning about Arithmetic Operators in SQL!
Return to Big SQL Energy Beginner homepage here to access the other lessons:
If youâre new here:
đđ˝ââď¸ Who Am I?
Iâm Jess Ramos, the founder of Big Data Energy and the creator of the BEST SQL course and community: Big SQL EnergyâĄď¸. Check me out on socials: đLinkedIn, đInstagram, đYouTube, and đTikTok. And of course subscribe to my đnewsletter here for all my upcoming lessons and updatesâ all for free!
âĄď¸ What is Big SQL Energy?
đBig SQL Energy Intermediate is an intermediate SQL course designed to solve real-world business problems hands-on using realistic data and a modern tech stack. Youâll walk away with 2 SQL portfolio projects, portfolio building guidance, access to the Big Data Energy Discord community, and lots of confidence for you upcoming coding interviews! You also get access to all monthly events including masterclasses, office hours, and guest speakers. This course is all of the most important things Iâve learned on the job as a Senior Data Analyst in tech who grew from a $72K salary to over a $150K salary. And now Iâm sharing it with YOU! Itâs more than just another courseâ itâs a challenging program designed to upskill your SQL to the intermediate level, get ready to ace your live coding interviews, and build connections in the data community through the Discord and events.
Lesson 7: Arithmetic Operators
Have you ever been like âwow I really wanna use SQL as a heavy duty, overkill calculatorâ? Well nowâs your chance! JK, but for real, weâre going to learn about arithmetic operators and do some basic math calculations in SQL. In the real word, these become very useful when it comes to data transformation and making new columns and metrics you donât already have in your datasets.
Arithmetic operators is a really fancy name, but weâre just going to be doing some basic elementary level math! We have 5 arithmetic operators in SQL:
Addition (+)
Subtraction (-)
Multiplication (*)
Division (/)
Thereâs also modulus (%), but Iâve never used that once in the real world, so donât even worry about this one unless youâre super curious! Hereâs examples of each:
select 1 + 3 ;
select 4 - 2 ;
select 5 * 10 ;
select 6 / 3 ;
A really interesting and important thing to note when it comes to calculations like this in SQL is that itâs possible to get a null value. If you have null values in your input, the output will be null because SQL doesnât know how to calculate it. Imagine 13 + NULL, whatâs the answer? Exactly! Itâs impossible to calculate because null is just an empty value.
Arithmetic operators are also great at adding and subtracting days to dates, and well learn another way to do this when we learn date functions later on!
select
order_id,
order_date,
order_date + 3,
order_date -7
from
orders
Now we know how to do basic arithmetic operations in SQL. Letâs move on over to the next lesson!!
If youâve enjoyed the free BEGINNER Big SQL Energy course, grab my intermediate course. There are no deadlines or timelines for this courseâ you start and take as long as you want. It will take your beginner skills to the next level and get you ready to ace your interviews. DM me or email me at courses@bdeanalytics.com if you have questions on the intermediate course!
Return to Big SQL Energy Beginner homepage here to access the other lessons: