Arithmetic Operators in SQL: Lesson 7 Free Beginner SQL Course
Who's still here following along? 👀
Got BDE?⚡️
Hi BDEs! Welcome to Lesson 6 of the free Big SQL Energy Beginner Course⚡️ Today we’re learning about string manipulation in SQL!
Don’t forget to snag my intermediate course at 20% off w/ code Jan2025. This deal will end at the end of the month after my Beginner series is complete, so don’t forget to take advantage and save big 💰 Reply to this email if you have Qs! Here to help you make the best decision for you ❤️
If you’re new here, 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.
Big SQL Energy Intermediate is an intermediate SQL course designed to solve real 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. 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!
Use code Jan2025 for 20% off for all of January!
But if you’re here for the free BEGINNER Big SQL Energy course, the next lesson for you is below! ⬇️
Lesson 0: Intro & Getting Started
Before you start, you’ll need access to any IDE (integrated development environment) for SQL of your choosing. I highly recommend using a 🔗Hex data science notebook because it’s easy to get started with and stored in the cloud— so no headaches to download and set up. However, you can alternatively use DBeaver, MySQL Workbench, SSMS, or any others if you’d prefer. Just import the dataset used in the lesson, and you’re ready to go! Remember, if you get stuck or experience errors, ChatGPT and Gemini are great resources to learn about syntax and help you debug. Alright, let’s get started!
🔗 Join Hex Data Science Notebooks: https://app.hex.tech/signup/big-data-energy
🔗 Datasets (Orders & Customers): https://github.com/jessramosdata/big-sql-energy-beginner
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 for 20% off NOW because this deal expires February 1. 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!
-xoxo,
jess💕
WHO AM I?⚡️
I'm Jess Ramos, a content creator, instructor, and leader in the data world. I'm super passionate about data and especially SQL— which inspired me to launch my own SQL course, Big SQL Energy! My 9-5 is being a Senior Data Analyst in tech. I'm also an Instructor with LinkedIn Learning and the founder of Big Data Energy Analytics. My 5-9 (aka outside of my regular job!) is creating amazing content for YOU on LinkedIn, Instagram, TikTok-- and this newsletter!🤩