From the course: Learning SQL Programming

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Math in SQL

Math in SQL - SQL Tutorial

From the course: Learning SQL Programming

Start my 1-month free trial

Math in SQL

- [Narrator] SQL supports various ways of doing math, and using mathematical functions on values and records. The most basic way of doing math and SQL is with a select statement and a mathematical expression. SQL supports the standard arithmetic operations, addition, subtraction, multiplication, and division, and also modulo. Mathematical operations are assumed to involve integers, and thus one or more of the terms is expressed in floating point. So you may get unexpected results if you don't pay attention to that. We can also use logical comparison operators like greater than, less than, greater than, or equal, less than or equal, equal and not equal to ask the database to give us results which match or fulfill those conditions. Like we might, if we wanted to see records with a quiz score greater than 70 points or where the state was not New York. We've used the equals operator already, but we can use these other competitors as well. Database management systems also provide…

Contents