SQL INTERVIEW QUESTIONS AND ANSWERS1 | P a g e SQL INTERVIEW QUESTIONS & ANSWERS
SQL INTERVIEW QUESTIONS AND ANSWERS2 | P a g e MOST FREQUENTLY ASKED SQL INTERVIEW QUESTIONS 1. What is the difference between “Stored Procedure” and “Function”?1.A procedure can have both input and output parameters, but a function can only have input parameters. 2.Inside a procedure we can use DML (INSERT/UPDATE/DELETE) statements. But inside a function we can't use DML statements. 3.We can't utilize a Stored Procedure in a Select statement. But we can use a function in a Select statement. 4.We can use a Try-Catch Block in a Stored Procedure but inside a function we can't use a Try-Catch block. 5.We can use transaction management in a procedure but we can't in a function. 6.We can't join a Stored Procedure but we can join functions. 7.Stored Procedures cannot be used in the SQL statements anywhere in the WHERE/HAVING/SELECT section. But we can use a function anywhere. 8.A procedure can return 0 or n values (max 1024). But a function can return only 1 value that is mandatory. 9.A procedure can't be called from a function but we can call a function from a procedure. 2.What is difference between “Clustered Index” and “Non Clustered Index”?3.A table with a Clustered Index is called a Clustered Table. Its rows are stored in a B-Tree structure sorted whereas a table without any clustered indexes is called a non-clustered table. Its rows are stored in a heap structure unsorted. 4.
SQL INTERVIEW QUESTIONS AND ANSWERS3 | P a g e 3.What is the difference between the “DELETE” and “TRUNCATE” commands?1.The DELETE command is used to remove rows from a table based on a WHERE condition whereas TRUNCATE removes all rows from a table.