Two Tables Database 1 Student Sid Last First Birthdate Gpa Advisor 2 Advisor Advisorid Adv Q43840699
I have two tables in my database.
1- Student (`sid`, `last`, `first`, `birthdate`, `gpa`,`advisor`)
2- Advisor ((`advisor_id`, `advisor_first`, `advisor_last`,`office`)
I need to :
Create a PHP file named db.php. Add code todb.php that connects to your database using a MySQL connection. Donot put any HTML in this PHP file, just PHP.
Create a second PHP file named Work3.php. Useinclude or require to bring indb.php and create the connection.
Add 5 queries to the Work3.php file. Thequeries should display the following. The data comes from thetables you created:
- sid, first, last, and birthdate columns for all students
- all data for the student whose sid is 818347712
- first, last, advisor for students whose advisor is 1 or2.
Only the advisor’s number is required. So, you do not need theadvisor table. You can add the advisor’s name if you want to createan SQL join. - first, last, birthdate for students whose birthdate is MORErecent than January 1, 1960 (hint: Do not include January 1,1960)
Order the result by birthdate, last, first - first, last, gpa for students whose gpa is between 3.0 and4.0
Use the SQL BETWEEN operator.
Order the result by gpa
In your PHP file display each query and result set asfollows:
- Heading row (e.g. use an <h1> element) with the SQL thatwas executed.
- The result rows one row per line
- Some white space (blank lines) then the next heading row.
Test your code. Compare the results with the phpMyAdminresults.
Expert Answer
Answer to I have two tables in my database. 1- Student (`sid`, `last`, `first`, `birthdate`, `gpa`, `advisor`) 2- Advisor ((`advis…
OR