Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

MySQL Select string getStudent ( float $min ) Given the following MySQL database

ID: 3638705 • Letter: M

Question

MySQL Select

string getStudent ( float $min )

Given the following MySQL database table.

+------------------------------------------------------------+
| interview_student |
+------------+-----------+------------+---------+------+-----+
| Student_ID | Last_Name | First_Name | College | GPA | ... |
+------------+-----------+------------+---------+------+-----+
| 463127376 | Willemsen | Lucas | A | 2.37 | ... |
| 338288531 | Hansen | Jocelyn | D | 2.56 | ... |
| 357921012 | Looysen | William | E | 3.90 | ... |
| 265307238 | Hester | Susan | E | 1.25 | ... |
| 152900535 | Gaddis | Robert | S | 2.45 | ... |
+------------+-----------+------------+---------+------+-----+

Construct a SELECT statement that returns: Student_ID, Last_Name, First_Name, GPA
for all of the students with a GPA of $min or better. Where $min will be the argument passed to your function.

Write a function 'getStudent' which takes one argument ($min) and returns the query string.

The function need only return a string which contains the MySQL statement. You do not need to handle the connection, submitting the query, parsing the results, etc. Just return a string that contains the MySQL statement.

Be sure the columns are returned in the specified order (Student_ID, Last_Name, First_Name, GPA).

Explanation / Answer

function getStudent($min) {
return "SELECT `Student_ID`, `Last_Name`, `First_Name`, `GPA` FROM `interview_student` WHERE `GPA` > ". $min;
}