Your contribution will go a long way in helping us serve more readers. In this article, I am giving some examples of SQL queries which sql injection types pdf frequently asked when you go for a programming interview, having one or two year experience on this field. LIKE operator, searching records in a bound using BETWEEN and IN clause, DATE and TIME queries etc.
If you have faced any interesting SQL query or you have any problem and searching for the solution, you can post it here for everyone’s benefit. Joe Cleko’s SQL Puzzles And Answers, one of the best books to really check and improve your SQL skills. Answer: There are many ways to find second highest salary of Employee in SQL, you can either use SQL Join or Subquery to solve this problem. See How to find second highest salary in SQL for more ways to solve this problem. Question 2: SQL Query to find Max Salary from each department. LEFT or RIGHT OUTER JOIN to include departments without any employee as well.
In this query, we have used RIGHT OUTER JOIN because we need the name of the department from Department table which is on the right side of JOIN clause, even if there is no reference of dept_id on Employee table. Question 3: Write SQL Query to display the current date. MSSQL function and it may not work on Oracle, MySQL or any other database but there would be something similar. Answer: This SQL query is tricky, but you can use BETWEEN clause to get all records whose date fall between two dates. Question 9: find all Employee records containing the word “Joe”, regardless of whether it was stored as JOE, Joe, or joe.
Question 11: Write SQL Query to find duplicate rows in a database? Question 12: There is a table which contains two column Student and Marks, you need to find all the students, whose marks are greater than average marks i. Question 13: How do you find all employees which are also manager? Answer: You need to know about self-join to solve this problem. One follow-up is to modify this query to include employees which don’t have a manager. To solve that, instead of using the inner join, just use left outer join, this will also include employees without managers. Question 14: You have a composite index of three columns, and you only provide the value of two columns in WHERE clause of a select query?
Will Index be used for this operation? Query given by previous Anonymous is correct. This will help you find any name whose name came with joe but if u want find only starting 3 letter who start with name Joe. That time u having use below query. You have a composite index of three columns, and you only provide value of two columns in WHERE clause of a select query? Can any one please help here? Need more sql questions of this kind.
Initial few question are upto standard . Some queries are very good but some one is very basic and please update this page after some period. Write SQL Query to find duplicate rows in a database? 1 from customer b where a. SANS Top 25 Most Dangerous Software Errors is a list of the most widespread and critical errors that can lead to serious vulnerabilities in software. They are often easy to find, and easy to exploit.