Recap - Engineer new columns
Part of the Fundamentals section of Coddy's SQL journey — lesson 30 of 72.
Challenge
EasyAvailable tables and columns:
<strong>items</strong>:<strong>id</strong>
A quartic function is defined:
f(x) = ax<sup>4</sup>+bx<sup>3</sup>+cx<sup>2</sup>+dx+e
Let's define the constant parameters:
a = 3b = 5c = 0.9d = 2.2e = 1
Fetch the ids and the quartic function where x is the id, and rename the column to quartic
Don't use built-in functions like
POWER()!
To calculate power of 2 or power of 3 use the following example:
a*a
-- power of 2
a*a*a
-- power of 3Try it yourself
All lessons in Fundamentals
4More Keywords
The IN keywordThe BETWEEN keywordThe LIKE keywordThe AS keywordRecap - Cellphone Models2Conditions
Conditions BasicsThe AND keywordThe OR keywordThe NOT keywordMultiple Conditions CombinedParenthesisBooleans5Arithmetic Operations
Mathematical OperatorsMathematical ColumnsThe Modulo OperationThe ROUND() Function3Specific Return Format
Null valuesSort Results Part 1Sort Results Part 2Recap - Cyber Security FirmLimit number of recordsRecap - Vehicle Factory6Intro Challenges
Recap - Parliamentary ElectionRecap - Police Criminal ArrestRecap - Bar Beverage ContainerRecap - Engineer new columns