Tuesday 27 August 2013

SQL Interview Questions And Answers

I have made every effort in writing this post to ensure the accuracy of the information. In this section you can find commonly asked SQL interview questions with their answers. This post surely helps you a lot at the interview. Best of Luck!


Q1: What is SQL?
A1: SQL stands for 'Structured Query Language'. SQL is used for accessing and manipulating database.

Q2: What is COUNT keyword in SQL?
A2: COUNT keyword is used to find the total number of records in a table.
Example: SELECT COUNT (*) FROM emp WHERE Sal>10000; returns all the records of the TABLE ‘emp’ where Salary is less than 10000.

Q3: What is GROUP BY clause?
A3: GROUP BY clause is used to group rows that have the same value.

Q4: What is the difference between a "WHERE" clause and a "HAVING" clause?
A4: The WHERE clause places conditions on the selected columns, whereas the HAVING clause places conditions on groups created by the GROUP BY clause.

Q5: What is SELECT statement?
A5: The SELECT statement is used to select a set of values from a table in a database.
For example: SELECT  *FROM emp WHERE Sal>10000


Q6: How do you delete a record from a database?
A6: DELETE statement is used to delete records or any particular column values from a database.

Q7: What's the difference between a Primary key and a Unique key?
A7: Both Primary key and unique enforce uniqueness of the column. Primary Key doesn`t allow NULL but Unique key allows one NULL.

Q8: What is the INSERT statement?
A8: Information’s are inserted in the database with the help of INSERT statement.

Q9: What are triggers? 

A9: Triggers are stored procedures that get executed automatically when an INSERT, UPDATE or DELETE operation takes place on a table. Triggers can't be invoked implicitly. 

Q10: What is the difference between Deleting and Dropping a table? 
A10: DELETE command deletes only data whereas Drop command delete data as well as Table structure.





No comments:

Post a Comment