Most Essential And Frequently Asked Interview Questions And Answer
The BETWEEN operator select all records between the given range whereas IN operator select all matching records given with WHERE clause.View Detials
View in SQL is a kind of virtual table. It does not physical exists in our database but have rows and column as there we have in real database table. we can create a view by selecting fields from one or tables present in the database. A View can have all the rows of a table or specific rows based on certain condition.View Detials
OPTIMIZE command is use for optimize a table.
OPTIMIZE TABLE `users`
The LIKE operator of SQL is used for such kind of operations. It is used to fetch filtered data by searching for a particular pattern in where clause.View Detials
There is only one primary key in a table. It creates the cluster index automatically and it cannot have NULL value
where as there can be multiple unique constraints in a table. It dose not creates the cluster index automatically and it can have NULL value
By using following query we can find out the nth largest salary from employees table.
SELECT salary FROM `employees` ORDER BY salary DESC LIMIT 1 OFFSET n-1
In the above query n is replaced by any number where n >= 1. Suppose you want to find fifth highest salary then you have to use offset = 5-1 i.e.: 4
The query will be:
SELECT salary FROM `employees` ORDER BY salary DESC LIMIT 1 OFFSET 4