SELECT POW(5, 2);
Output of this is
25
For negative
SELECT POW(4, -2);
Output is
0.0625
require 'config.php'; // Database connection
$stmt = $dbo->prepare(
'INSERT INTO sql_pow (a, b) VALUES (:a, POW(:base, 2))'
);
for ($i = 1; $i <= 10; $i++) {
$stmt->execute(['a' => $i, 'base' => $i]);
}
Author & Instructor at plus2net
I write and maintain practical tutorials on Python, PHP, SQL, JavaScript, HTML, jQuery, and web development at plus2net. The tutorials focus on clear explanations, working examples, and code that readers can test and adapt while learning.