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

Easy SQL: Square Root and Log

daco2020 2022. 5. 17. 23:13
반응형

Given the following table 'decimals':

** decimals table schema **

  • id
  • number1
  • number2

Return a table with two columns (root, log) where the values in root are the square root of those provided in number1 and the values in log are changed to a base 10 logarithm from those in number2.

 

Solution:

SELECT SQRT(number1) AS root, LOG(number2) FROM decimals;

SQRT is a function that finds the square root.
LOG is a function that finds the logarithm.
POWER is a function that finds the square.

 

 

 

 

반응형

'나는 이렇게 학습한다 > Algorithm & SQL' 카테고리의 다른 글

Even or Odd  (0) 2022.05.19
SQL Basics: Simple DISTINCT  (0) 2022.05.18
Collect Tuition (SQL for Beginners #4)  (0) 2022.05.16
Expressions Matter  (0) 2022.05.15
SQL Basics: Mod  (0) 2022.05.14