Professional Documents
Culture Documents
5 211003003056
QUESTION: 1. Drop and create Student and Department tables. Don’t create
Primary key, unique key, or foreign key constraints on the tables now.
QUERY:
OUTPUT:
OUTPUT:
OUTPUT:
QUESTION: 4. Create a nonclustered index on name, address columns of the
Student table only for the students whose address is Kolkata.
QUERY: CREATE NONCLUSTERED INDEX NONINDEX ON STUDENT
(NAME,ADDRESS) WHERE ADDRESS='KOLKATA'
OUTPUT:
QUESTION: 5. Drop and recreate the nonclustered index. Email and phone
columns should be added as included columns.
QUERY: DROP INDEX STUDENT.NONINDEX
OUTPUT:
'2002-05-09','2021-08-29','2025-09-15',101);
'2003-06-03','2020-01-27','2024-07-16',102);
'2000-12-12','2019-03-17','2021-11-09',103);
'2025-04-11','2027-11-05',104);
'2017-02-11','2019-11-07',101);
'2018-01-10','2020-12-04',103);
'2025-07-16','2021-12-04',102);
'2025-04-25','2028-12-29', 106) ;
'2025-12-25','2027-10-25', 101) ;
OUTPUT:
QUESTION: 7. Create a view named vStudentDept to retrieve student id,
studentname and departname by joining both the tables. WITH
SCHEMABINDING option should be added.
QUERY: CREATE VIEW vStudentDept WITH SCHEMABINDING AS(SELECT
STUDENT.NAME, STUDENT.ID,DEPARTMENT.DEPTNAME FROM STUDENT
INNER JOIN DEPARTMENT ON STUDENT.DEPTID = DEPARTMENT.DEPTID);
OUTPUT:
OUTPUT: