filmov
tv
SQL Tutorial for Data Analysis 5: Arithmetic Operations

Показать описание
In this SQL Tutorial we're going to learn how to use Arithmetic operations. Arithmetic operations are simply mathematical calculations such as subtraction, addition, or division.
Key Concepts to remember -
* On numerical columns it is permitted to perform any mathematical calculation
* It is not possible to perform any arithmetic operations on a string datatype
* On dates - multiplication or division are not possible. Addition and subtraction adds or subtract days.
* Any calculation on a NULL returns NULL.
* Calculations do not change the actual data, they only change the way values of columns are displayed.
* Different calculations set the column’s header to (No Column Name) We’ll address this issue in our next video
Course Examples -
ACDB Database -
Written SQL tutorials including exercises -
About Myself -
My Linkedin Page -
My Facebook Page -
SQL Platform Differences (comparing MySQL & Oracle)
MySQL -
* Arithmetic operations over strings - MySQL treats the string as 0. So for example: 'Hello' + 5 would yield 5, 'Hello'*5 would yield: 0
* MySQL Arithmetic operations over dates - Every calculation on a date value converts the date into a number, and perform the calculation over the number. so for example: 2006-08-23 00:00:00.000000 + 1 would yield: 20060823000001.000000
* Different calculations set the column’s header to the new calculation, so for example, the expression: join_date + 5, sets the column's header to join_date + 5
Oracle -
* Different calculations set the column’s header to the new calculation, so for example, the expression: join_date + 5, sets the column's header to join_date + 5
Key Concepts to remember -
* On numerical columns it is permitted to perform any mathematical calculation
* It is not possible to perform any arithmetic operations on a string datatype
* On dates - multiplication or division are not possible. Addition and subtraction adds or subtract days.
* Any calculation on a NULL returns NULL.
* Calculations do not change the actual data, they only change the way values of columns are displayed.
* Different calculations set the column’s header to (No Column Name) We’ll address this issue in our next video
Course Examples -
ACDB Database -
Written SQL tutorials including exercises -
About Myself -
My Linkedin Page -
My Facebook Page -
SQL Platform Differences (comparing MySQL & Oracle)
MySQL -
* Arithmetic operations over strings - MySQL treats the string as 0. So for example: 'Hello' + 5 would yield 5, 'Hello'*5 would yield: 0
* MySQL Arithmetic operations over dates - Every calculation on a date value converts the date into a number, and perform the calculation over the number. so for example: 2006-08-23 00:00:00.000000 + 1 would yield: 20060823000001.000000
* Different calculations set the column’s header to the new calculation, so for example, the expression: join_date + 5, sets the column's header to join_date + 5
Oracle -
* Different calculations set the column’s header to the new calculation, so for example, the expression: join_date + 5, sets the column's header to join_date + 5
Комментарии