EXP Function in SQLThe EXP is a SQL function of mathematics which returns e raised to the power of given number. Syntax of EXP FunctionIn the EXP syntax, we have to pass that decimal number whose e raised value we want to return. In the Structured Query Language, we can also use the EXP function with the field of the table as shown in the following block: In this syntax, we have to define the name and column of that table on which we want to perform the EXP function. Examples of EXP functionExample 1: This example returns the e raised to the power of the specified number: Output:
Example 2: This example returns the e raised to the power of the specified number: Output:
Example 3: This example returns the e raised to the power of 90: Output:
Example 4: This example returns the e raised to the power of -45: Output:
Example 5: This example returns the e raised to the power of the given expression: Output:
Example 6: This example uses the EXP function with the SQL table. In this example, we will create the new table through which we will perform the EXP function on the columns: The following shows the syntax to create the new table in SQL: The following CREATE statement creates the Vehicle_Details table for storing the details of purchasing and selling vehicles: The following multiple INSERT queries insert the records of vehicles with their quantity, and number of selling and purchasing vehicles into the Vehicle_Details table: The following SELECT statement displays the inserted records of the above Vehicle_Details table:
Query 1: The following SELECT query uses the EXP function with the Vehicle_ID column of the above Vehicle_Details table: This query shows the e raised to the power of vehicle id of each vehicle. Output:
Query 2: The following SELECT query uses the EXP function with the Purchasing_Vehicles column of the above Vehicle_Details table: This query shows the e raised to the power of purchasing vehicles. Output:
Query 3: The following SELECT query uses the EXP function with the Vehicle_Rating column of the above Vehicle_Details table: This query shows the e raised to the power of rating of each vehicle from the above table. Output:
Query 4: The following SELECT query uses the EXP function with the and Purchasing_Vehicles and Selling_Vehicles column of the above Vehicle_Details table: This query shows the e raised to the power of selling Vehicles of each vehicle. Output:
Next TopicRADIANS Function in SQL |