2. Establish an appropriate index for the tables created above, and describe the process of indexing (can or write SQL). It is required to establish an index on the Sno, PNo fields in the SPJ, and an index for the combination of (PNo, Jno). is the index on SNO and pno a clustered index or a nonclustered index? Why?
Attached code:
1 Create Index on SPJ (SNo) 2 Create Index on SPJ (PNo) 3 Create Clustered Index on SPJ (SNo, PNo);
3. Please teach yourself the trigger section of the Chinese book P160, and with the help of SQL Server, create a trigger that, when inserting data into table p,
Insert this data into a new table of your own, and the structure of the table is consistent with the P-label (append).
Attached code:
1 Create TriggerInsert_trigger2 onBranch3 for Insert4 as 5 Print 'Data Backup ...'6 if(object_id('Bankup','U') is not NULL)7 Insert intoBankupSelect * fromBranch;8 Else 9 Select * intoBankup fromBranch;Ten Print 'Data Backup Complete' One Go