Write SQL queries to answer the following questions: A. What are the courses inc
ID: 666789 • Letter: W
Question
Write SQL queries to answer the following questions:
A. What are the courses included in the Section table? List each course only once.
B. List all students in alphabetical order by Student Name
C. List the students who are enrolled in each course in Semester I, 2008. Gro the students by the sections in which they are enrolled.
D. List the courses available. Group them by course prefix. (ISM is the only prefix shown, but there are many others throughout the university.)
e. Which courses were taught in the first semester of 2008 but not in the second semester of 2008.
Explanation / Answer
1)List course id from section table
Query:
SELECT DISTINCT CourseID from SECTION;
Description:
The above query selects unique course id numbers from the section table
------------------------------------------------------------------------------------------------------------------------------------
2)List all students in alphabatical order
Query:
SELECT StudentName from STUDENT ORDER BY StudentName;
Description:
The above query orders studets names alphatically using order by clause
of the students names.
The ORDER BY keyword sorts the students names ascending order.
------------------------------------------------------------------------------------------------------------------------------------
3)List the studets who enrolled in the sem-2008
Query:
SELECT StudetID,StudentName
from STUDENT WHERE StudentID IN
(SELECT StudentID FROM REGISTRATION WHERE SemesterID='I-2008' GROUP BY SectionNo);
Description:
select the student id numbers from the registration table where the semester id is I-2008
and then select those id numbers from the student table and group the results by section number.
------------------------------------------------------------------------------------------------------------------------------
4)List available course and group by course id
Query:
SELECT CourseID from COURSE GROUP BY CourseID;
Description:
The above query selects the course id numbers from the table COURSE
and group them by Course id.
------------------------------------------------------------------------------------------------------------------------------
5)There are no columns to specify the first and second semester of courses to select
from the course table
Hope this helps you
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.