Student table contains all the data that needs to be listed.
(I have 16 fields.)
Student schedules sections.
Schedules table has StudentID and SectionID as fields, they both are primary keys.
(For example, StudentID 1234 is scheduled for SectionID 15,19,24,25.)
Section table has ID (SectionID in Schedules table), OfferedAsDisciplineName and OfferedAsNumber. They are referenced to 2 primary keys in Course table, as DisciplineName and Number.
Course table has DisciplineName and Number as primary keys, and Hours. Each course is assigned 3 hours.
I am trying to write the SQL script to where it recognizes students who are enrolled in CIS course, then count the hours to see if it is above 3, since all the courses have 3 hours, so if they take one CIS course then they only have 3 hours, and I am looking for students who at least have 6 or more.
How can I list all student information for students enrolled in more than one CIS course? (SQL Server Query)?
You can use *
select * from student s, section sec where s.studentID=1234 and sec.SectionID=15
Reply:your question is quite confusing because its not stated well but il give you the syntax..
if u want to select something
select %26lt;fieldname%26gt; from %26lt;tablename%26gt;
where %26lt;condition%26gt;
if you want to count something
select count%26lt;fieldname%26gt; from %26lt;tablename%26gt;
%26lt;condition%26gt;
if you want to connect multiple tables
select %26lt;tablename.fieldname%26gt;, %26lt;tablename.fieldname%26gt;
from %26lt;tablename%26gt;
you could right as many as you want for the multiple tables.. just be sure ul be putting a dot "." in between tablename and fieldname..
No comments:
Post a Comment