I have student marks in a student table. I need second
highest mark .Then what will the query for this?
Answers were Sorted based on User's Feedback
Answer / vk
select studentid,student_name,marks from
(select row_number() over (partition by marks order by marks desc) as rnk,studentid,student_name,marks from student_marks)
where studentid in (1,4);
Is This Answer Correct ? | 0 Yes | 0 No |
Answer / lokeshwaran s
SELECT MAX(marks) AS second_highest_mark
FROM student
WHERE marks < (SELECT MAX(marks) FROM student);
Is This Answer Correct ? | 0 Yes | 0 No |
Answer / koti,khammam
select max(mark) from student where mark not in (select max
(mark) from student)
Is This Answer Correct ? | 1 Yes | 2 No |
Answer / poomanibe
with temptab as
(
select row_number() over(order by substring(marks,1,2)) as
rownum,* from Student
)
select * from temptab where rownum=1
Is This Answer Correct ? | 0 Yes | 1 No |
Answer / dharmendra k. dixit
SELECT TOP 1 Marks (SELECT TOP 2 Marks from Tablename Order
by Marks Desc)From Tablename order by Marks Asc
Is This Answer Correct ? | 0 Yes | 2 No |
Answer / rupa
Select max(Marks) from Marks where Marks <
(select max(Marks)from Marks)
Is This Answer Correct ? | 0 Yes | 2 No |
Answer / sagesh
SELECT * FROM(
SELECT ROW_NUMBER() OVER (ORDER BY mark) AS Stu_Rank
FROM student) As T
WHERE Stu_Rank = 2
Is This Answer Correct ? | 2 Yes | 5 No |
i use few third party softwares. they r all having their own databases . but the data is repeated in all these databases - say a person is in all the three databases, but his name is stoared in diff format in all databases i want to create a centralised database ,and i dont want to re-enter the records . using the exisating records how can i build a centralised database?
What does select 1 mean?
What do you mean by COLLATION?
what are the different types of replication you can set up in sql server? : Sql server database administration
What is explicit mode in sql server?
What is the difference between getdate and sysdatetime?
Explain DBMS, RDBMS?
Any one plz send me SQL Server Developer/DBA resume for 4 years experience
I need a query that retrieves info from an Oracle table and a query that retrieves info from a SQL Server table. The info has to be joined together according to Record ID numbers. I have very limited access to the Oracle database but full control of the SQL Server database.How do I join two different queries from two different databases?
What is log shipping? Can we do logshipping with SQL Server 7.0 - Logshipping is a new feature of SQL Server 2000. We should have two SQL Server - Enterprise Editions. From Enterprise Manager we can configure the logshipping. In logshipping the transactional log file from one server is automatically updated into the backup database on the other server. If one server fails, the other server will have the same db and we can use this as the DR (disaster recovery) plan.
What is left outer join in sql server joins?
Where can you add custom error messages to sql server?