Question: Write the SQL that will retrieve the following results: STUID FNAME LNAME ADVISORFNAME ADVISORLNAME 2001 Tanisha Blake Jake Plummer 2003 Jonathan Wu Kelly Christensen 2004
Write the SQL that will retrieve the following results:
| STUID | FNAME | LNAME | ADVISORFNAME | ADVISORLNAME |
| 2001 | Tanisha | Blake | Jake | Plummer |
| 2003 | Jonathan | Wu | Kelly | Christensen |
| 2004 | Alvin | Klein | Jake | Plummer |
| 2005 | John | Jenkins | Michelle | Kwon |
The STUDENT table is as follows:
| STUID | FNAME | LNAME | ADVISOR_ID |
| 2001 | Tanisha | Blake | 2 |
| 2002 | Jess | Goldwasser | NULL |
| 2003 | Jonathan | Wu | 3 |
| 2004 | Alvin | Klein | 2 |
| 2005 | John | Jenkins | 1 |
The ADVISOR table is as follows:
| ADVISOR_ID | ADVISORFNAME | ADVISORLNAME |
| 1 | Michelle | Kwon |
| 2 | Jake | Plummer |
| 3 | Kelly | Christensen |
| 4 | Nick | Jonas |
Step by Step Solution
3.55 Rating (148 Votes )
There are 3 Steps involved in it
You can achieve this by using a SQL query that involves joining the STUDENT and ADVISOR tables based on the ADVISORID Heres the SQL query SELECT sSTUID sFNAME sLNAME aADVISORFNAME aADVISORLNAME FROM STUDENT s JOIN ADVISOR a ON sADVISORID aADVISORID This query selects the desired columns from the STUDENT table and joins it with the ADVISOR table ... View full answer
Get step-by-step solutions from verified subject matter experts
