Skip to main content

Posts

Showing posts with the label Examples

What is a Database?

The database is a collection of data and this data is stored in form of tables at logical level, and in the data files at the physical level. There are some other files as well like Redo log files, Control files, Initialization files which stores important information about the database.

Can you get second highest salary from the table?

Query:- SELECT Emp_Name,Emp_Salary FROM Employee e1 WHERE 2 = (SELECT COUNT(DISTINCT (e2.Emp_Salary))FROM Employee e2 WHERE e2.Emp_Salary >= e1.Emp_Salary) The above employee table contains two same records as second highest salary so the result set will look like below output table. Output:- Emp_Name Emp_Salary Sham 15000