CodeBlanks Logo Icon CodeBlanks

POWER and SQRT

Take powers and square roots.

POWER and SQRT

POWER(x, y) returns x raised to y; SQRT(x) returns the square root.

SELECT POWER(2, 10) AS iki_us, SQRT(16) AS kok;

2 to the 10th = 1024; square root of 16 = 4.

The expression POWER(2, 10) AS iki_us, SQRT(16) AS kok is evaluated and returned.

POWER and SQRT — details

POWER(2, 3) = 8. SQRT errors on negative numbers. You can also use POWER(x, 0.5) instead of SQRT.

Practice POWER and SQRT

Select the square root of 16 aliased as kok.

Starter code

query.sql
-- square root
SELECT

Expected output

kok
4

Questions and answers

Review the lesson questions together with their answers. To test yourself, solve the lesson interactively.

1 What is POWER(3, 2)?

  • 9 Correct answer
  • 6
  • 3
  • 8

Explanation: POWER(3, 2) is 3 squared: 3 × 3 = 9.

2 Square root

Question
SELECT ____(16);
Answer
SELECT SQRT(16);

Explanation: SQRT takes the square root; SQRT(16) gives 4.

3 POWER and SQRT: match the terms

Term Meaning
POWER power
SQRT square root
ABS absolute
ROUND round

All lessons in Beginner