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: