QUESTION SESSION NAME:SQL Functions - 2 QUESTION NAME: Round, Power and Square root Function TABLE DESCRIPTION In this task, the user needs to write a query to implement Round, Power and Square root function.
Note: Use SQL in-built Function to calculate round, power and square root function for station table.
The user needs to implement round, power and square root function for the column lat_n and long_w and ID in customers table
Round the lat_n method to TWO digits.
1. Hint: round(lat_n , 2).
2. For power function :
Use lat_n value as one parameter "x" value and the "y" as 5. Note: power(x,y) X= value denoted , lat_n and Y denotes="5"
Use long_w value as one parameter "x" value and the "y" as 7. Note: power(x,y) X= value denoted , long_w and Y denotes="7"
2 Comments
QUESTION
ReplyDeleteSESSION NAME:SQL Functions - 2
QUESTION NAME: Round, Power and Square root Function
TABLE DESCRIPTION
In this task, the user needs to write a query to implement Round, Power and Square root function.
Note: Use SQL in-built Function to calculate round, power and square root function for station table.
The user needs to implement round, power and square root function for the column lat_n and long_w and ID in customers table
Round the lat_n method to TWO digits.
1. Hint: round(lat_n , 2).
2. For power function :
Use lat_n value as one parameter "x" value and the "y" as 5.
Note: power(x,y) X= value denoted , lat_n and Y denotes="5"
Use long_w value as one parameter "x" value and the "y" as 7.
Note: power(x,y) X= value denoted , long_w and Y denotes="7"
3. Square root function for column ID.
Input Format
The station table is described as follows:
SESSION NAME:SQL Functions - 2
ReplyDeleteQUESTION NAME: MID FUNCTION - SCALAR FUNCTION - NAME column
TABLE DESCRIPTION
MID Function:
MID Function has three parameters:
First Parameter = Column Name
Second Parameter = Start Length
Third Parameter = Length of characters to be displayed
Note: Index starts from 1.
Example:
MID(column_name, start, length) from table-name;
Write a FUNCTION to display the name column of employee table using mid function.
The start length (index) is 1 and display total of 3 characters in name column.
Table Name : emp
Columns
eid - Number
name - varchar
age - Number
salary - Number
ANSWER:
select mid(name,1,3)from emp;