Should I make for '이홍근's student sno count
[Search for the number of courses registered by '이홍근]
This is my own
SELECT COUNT (*) AS Number of courses
FROM STUDENT AS S, ENROL AS E
WHERE S.SNO = E. SNO
AND S.NAME = '이홍근';
Is this right?
I just asked SQL and just need an answer.
Answers
Your SQL query looks mostly correct for counting the number of courses registered by a student named '이홍근'. However, there is a small typo in your query. The dot "." between "E." and "SNO" should not have a space. Here's the corrected version of your query:
SELECT COUNT(*) AS "Number of courses"
FROM STUDENT AS S
JOIN ENROL AS E ON S.SNO = E.SNO
WHERE S.NAME = '이홍근';
This query will count the number of courses registered by the student named '이홍근'.