Print out the number of classes that each student is taking;
omit students taking no classes. Sort by student name
The procedure can be called
pro_student_stats.
Below is the create table/insert statements
CREATE TABLE dbo.STUDENT
(snum int,
sname nvarchar(12),
MAJOR nvarchar(12),
DEPT_ID int,
slevel nvarchar(12),
AGE int,
CONSTRAINT STUDENT_SNUM_pk PRIMARY KEY (SNUM));
REATE TABLE dbo.CLASS
(CNAME nvarchar(12),
MEETS_AT time,
ROOM nvarchar(10),
FID int,
CONSTRAINT CLASS_CNAME_pk PRIMARY KEY (CNAME));
CREATE TABLE dbo.FACULTY
(FID int,
FNAME nvarchar(40),
DEPT_ID int,
CONSTRAINT FACULTY_FID_pk PRIMARY KEY (FID));
insert into dbo.STUDENT values
(0418,'S.Jack','Math',2,'SO',17);
insert into dbo.STUDENT values
(0671,'A.Smith','English',2,'FR',20);
insert into dbo.STUDENT values
(1234,'T.Banks','ME',3,'SR',19);
insert into dbo.STUDENT values
(3726,'M.Lee','Physics',4,'SO',21);
insert into dbo.STUDENT values
(4829,'J.Bale','Chemistry',5,'JR',22);
insert into dbo.STUDENT values (5765,'L.Lim','CS',1,'SR',19);
insert into dbo.STUDENT values (0019,'D.Sharon','History',
4,'FR',20);
insert into dbo.STUDENT values (7357,'G.Johnson','Math',
4,'JR',19);
insert into dbo.STUDENT values
(8016,'E.Cho','History',2,'JR',19);
insert into dbo.CLASS values ('ENG400',cast('08:30' as
time),'U003',107);
insert into dbo.CLASS values ('ENG320', cast('09:30' as
time),'R128',107);
insert into dbo.CLASS values ('COM100', cast('11:30' as
time),'L108',107);
insert into dbo.CLASS values ('ME308', cast('10:30' as
time),'R128',109);
insert into dbo.CLASS values ('CS448', cast('09:30' as
time),'U003',106);
insert into dbo.CLASS values ('HIS210', cast('01:30' as
time),'L108',104);
insert into dbo.CLASS values ('MATH275', cast('02:30' as
time),'L108',108);
insert into dbo.CLASS values ('STAT110', cast('04:30' as
time),'R128',108);
insert into dbo.CLASS values ('PHYS100', cast('04:30' as
time),'U003',105);
insert into dbo.FACULTY values (101,'S.Layton',4);
insert into dbo.FACULTY values (102,'B.Jungles',1);
insert into dbo.FACULTY values (103,'N.Guzaldo',3);
insert into dbo.FACULTY values (104,'S.Boling',2);
insert into dbo.FACULTY values (105,'G.Mason',1);
insert into dbo.FACULTY values (106,'S.Zwink',2);
insert into dbo.FACULTY values (107,'Y.Walton',1);
insert into dbo.FACULTY values (108,'I.Teach',2);
insert into dbo.FACULTY values (109,'C.Jason',3);
Below is an example of what it should look like
procedure pro_enroll Trigger S. Jack*Y.Walton*ENG320 s.Jack*s. Zwink*CS448 Student 418 has been added to, ENG320
Print out the number of classes that each student is taking; omit students taking no classes. Sort by student name The p
-
answerhappygod
- Site Admin
- Posts: 899604
- Joined: Mon Aug 02, 2021 8:13 am
Print out the number of classes that each student is taking; omit students taking no classes. Sort by student name The p
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!