Answer to Question #52632 in Programming & Computer Science for Makinon

Question #52632
A database table called PERSON contains the fields NAME, BASIC and HRA. Write a computer program to print a report with employee name and total salary for those employees whose total salary is more than 10,000. Total Salary = BASIC + HRA. At the end, the program should also print the total number of employees whose total salary is
more than 10,000.
1
Expert's answer
2015-06-05T04:30:53-0400
Code (MySQL).
SELECT * FROM PERSON
WHERE BASIC + HRA > 10000;
Code(PHP).
$sql = " SELECT *FROM PERSON WHERE BASIC + HRA > 10000";
$result = $conn->query($sql);

if ($result->num_rows > 0) {
echo$result->num_rows . " results";
while($row = $result->fetch_assoc()) {
        echo"Name: " . $row["NAME"]. "Basic: " . $row["BASIC"]
. " " . $row["HRA"] . "<br>";
    }
} else {
    echo "0 results";
}
 


Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS