나는 이렇게 학습한다/Algorithm & SQL

Easy SQL: Cube Root and Natural Log

daco2020 2022. 5. 27. 20:00
반응형

Given the following table 'decimals':

** decimals table schema **

  • id
  • number1
  • number2

Return a table with two columns (cuberoot, logarithm) where the values in cuberoot are the cube root of those provided in number1 and the values in logarithm are changed to the natural logarithm of those in number2.

 

 

Solution:

SELECT 
  CBRT(number1) as cuberoot,
  LN(number2) as logarithm
FROM 
  decimals

The cube root is the CBRT function,
The natural logarithm can be found using the LN function.

 

 

 

Result:

cuberoot logarithm
15.883041847144092 8.029598276755332
14.695124005670634 7.949951736535845
8.586161784211237 7.443732089574755
9.265318579835226 8.36619019659569
11.131669954585497 8.169347418692219
15.89144564007865 6.933330006827099
7.856801233263617 8.141132932853179

 

 

 

반응형