Quiz2 2021 Cmuis401sc
Quiz2 2021 Cmuis401sc
Duration: 30 minutes
Enrolled(snum, cname)
1.1. Create Procedure have function list the details of student when inputing data to the
snum field
GO
@SNUM CHAR(3)
AS
ELSE
No 2 Page 1
1.2. Write trigger: when inserting data to the Class table, then check the existence fid in the
FacultyTable
GO
FOR INSERT
AS
IF NOT EXISTS(SELECT fid FROM Faculty WHERE fid = (SELECT fid FROM
INSERTED))
ELSE
1.3. For each of the following reports, indicate any indexes that you feel would help the report
run faster as well as the type of index. Write SQL commands to create indexes for each
attribute you identified
ON Enrolled(snum);
ON Enrolled(cname);
2.1. Creates the login ‘MARY’. The user login starts with the password "123," but that
password must be changed after the first login.
No 2 Page 2
CREATE USER MARY FOR LOGIN MARY;
2.4. To Revoke UPDATE, DELETE privilege on the Emp from user ‘MARY’
No 2 Page 3