Monday, March 28, 2016

SQL INDEX


1. Joins
- Cartesian product - Cross join
- self join
- 4 conventional joins

2. Views - DONE

3. Indexing
- Clustered
- Non-Clustered - DONE

4. Normalization - DONE

5. Stored procedure

6. Aggregation

7. What is a Stored Procedure?

8. What is a Trigger?

9. ROW_NUMBER - DONE

10. How is ACID property related to Database ?

11. How to Delete Duplicate Rows ?

SELECT FirstName, LastName, MobileNo, COUNT(1) as CNT
FROM CUSTOMER
GROUP BY FirstName, LastName, MobileNo
HAVING COUNT(1) > 1;

with x as   (select  *,rn = row_number()
            over(PARTITION BY OrderNo,item  order by OrderNo)
            from    #temp1)
select * from x
where rn > 1

12. How to find n th highest salary record ? - with sunquery - DONE

SELECT TOP 1 Incentive_amount
FROM (
 SELECT DISTINCT TOP 3 Incentive_amount
 FROM Incentive
 ORDER BY Incentive_amount DESC
 ) AS Emp
ORDER BY Incentive_amount


No comments:

Post a Comment