05 Perform Mathematical Functions in MySQL
05 Perform Mathematical Functions in MySQL
Prerequisites: None
Steps to be followed:
1. Log in to the MySQL Database
2. Create a Database and Table
3. Use the SQUARE ROOT function
4. Use the EXPONENTIAL function
5. Use the LOG function
6. Use the BASE-10 LOG function
7. Use the RANDOM NUMBER function
3.1 Calculate the square root of the numbers in the number_column of the
math_data table using the SQRT() function
SQL Code:
SELECT id, number_column, SQRT(number_column) AS square_root
FROM math_data;
Step 4: Use the EXPONENTIAL function
7.1 Generate a random number for each row using the RAND() function
SQL Code:
SELECT id, RAND() AS random_number FROM math_data;
Mathematical functions are executed on a specific dataset using these
procedures.