write a query for the fifth highest salary?

Answer Posted / piyush gupta

select distinct(a.sal) from emp a where 5=(select
count(distinct(b.sal)) from emp b where a.sal<=b.sal)


you can this query for nth highest salary
replace 5 with any number

Is This Answer Correct ?    2 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

what is transaction state, buffer management, shadow paging

2926


Explain partial key?

654


What is the Lock Based Protocol used for?

638


What the various ways to tune a teradata query

2789


What advantages does DBMS have over traditional file systems?

591






How default key is different from primary key?

616


What is a database example?

536


What is replicaset?

589


What is the use of graph database?

548


Differentiate between extension & intension?

868


Explain database partitioning.

634


Which database does facebook use?

517


Explain the various types of normalization.

641


How do I setup a database connection?

518


london school of science and technology has a software development unit,known as lsst solutions,which is responsible for developing and implementing software throughout the collegejames tristan keeps a record of all student details in the college including student id,name,and start date and phone number.There are many courses offered by LSST. For example MBA, MSc, BSc, BABS, DF, English etc. Each course id identified by course id, description, duration. Each course has many semesters. Each semester takes place during a particular term. Semester details and term details are required to be stored in the database. Each course has many subjects and same subject may be offered in many courses. For each subject many details such as Subject code, name, result and attendance are required to be stored. Every subject has mainly two assessments; one assignment and one exam. Assignment is worth of 30% and exam 70% respectively. You have been appointed as a database designer. Your job is to provide ERD with all possible entities and relationships. Note: Feel free to make necessary assumptions 3: Assignment Tasks. 1. Create an ERD for the above problem 2. Translate the ERD to Relational Data model (RDM) 3. Implement the RDM by creating the tables 4. Populate the database with your own data. 5. SQL Queries for the following tasks a. List all student details in each course along with course details b. Count and display number of students in each course. c. List student name, course name, assessment description, marks for all students.

2002