Part of the answer refers to GPT, GPT_Pro better solution
Query which courses are not taken by students, list the course number and course name, can use external link method, External join is to connect some common fields in two tables to realize associated query between two tables. That is, use the LEFT JOIN keyword in the SQL statement to join two tables. In this case, we need to connect the Course table with the SC table first, and then query the Course number and course name that no student chose in the course table according to the fact that Sno column in the SC table does not have a record. The code is as follows:
In the SQL statement above, we use the LEFT JOIN keyword to join the Course table and SC table; Then, according to the case that Sno column in SC table does not have a record(that IS, sc. Cno IS NULL), the Course number and course name selected by no students in the course table are queried. After running the above SQL statement, you will get the desired result.
SELECT C.Cno, C.Cname FROM Course C LEFT JOIN SC S ON C.Cno = S.Cno WHERE S.Cno IS NULL;
If the answer is helpful, please accept it.