You can do math with SQL! Find out how to use the basic operators, and explore some of the more advanced commands.
- [Instructor] SQL supports various ways…of doing math, and using mathematical functions…on values and records.…The most basic way of doing math in SQL…is with a select statement and a basic operation.…SQL supports the standard arithmetic operations,…addition, subtraction, multiplication, and division,…and also the modulo operator.…Mathematical operations are assumed to be integers…unless one or more terms is expressed in floating point,…so you may get unexpected results if you don't…pay attention to that.…Let's take a quick look at doing some addition…with integers.…
I'll write select, four plus two and a semicolon.…And then I'll run the statement and here…I get the result of six.…I can change this to one divided by three…and I get zero.…One divided by three in the integer space is zero,…but one divided by three point zero,…a floating point value, is what we would expect, 0.333…and so on.…The precision of the result is still limited, though,…so it's a good idea not to rely on SQL math…for financial or scientific applications…
- Name the predicate of the following statement: SELECT EyeColor, Age FROM Student WHERE FirstName = 'Tim' ORDER BY LastName ASC;
- Explain what to use to enforce the order in which an expression must be evaluated if the WHERE clause contains multiple expressions to evaluate.
- Identify the best option to join two tables in a database to be able to display data from both.
- List a data type that is not numeric.
- Determine the result of running the following statement on a table containing columns col_1 and col_2:
- INSERT INTO Box (col_1, col_2) VALUES ('A', 'B'), ('A', 'B'), ('A', 'B'), ('A', 'B');
- Determine the best approach of deleting Jon Ramirez (ID 3452) from a Student table.