Here is a sample approach
CREATE TABLE #Students (ID INT IDENTITY(1,1), Student VARCHAR(50), Class INT)
INSERT INTO #Students
SELECT 'Raj', 5 UNION ALL
SELECT 'Ram', 1 UNION ALL
SELECT 'Ratan', 4 UNION ALL
SELECT 'Raj', 6 UNION ALL
SELECT 'Dijen', 3 UNION ALL
SELECT 'Ratan', 7 UNION ALL
SELECT 'Ritesh', 12
SELECT * FROM #Students
UPDATE #Students
SET Class = 1
WHERE ID IN
(SELECT MIN(ID) AS ID FROM #Students GROUP BY Student)
SELECT * FROM #Students
DROP TABLE #Students