SQL Interview Questions and Answers for Freshers, Experienced | Database - Page 5
29. What is a stored procedure?
Frequently asked SQL Interview Questions
Stored Procedure is a function which contain collection of SQL Queries. Procedure can take inputs , process them and send back output.
30. What are the advantages a stored procedure?
Stored Procedures are precomplied and stored in database. This enable the database to execute the queries much faster. Since many queries can be included in a stored procedure, round trip time t o execute multiple queries from source code to database and back is avoided.
31. What is a trigger?
Database are set of commands that get executed when an event(Before Insert,After Insert,On Update,On delete of a row) occurs on a table,views.
32. Explain the difference between DELETE , TRUNCATE and DROP commands?
Once delete operation is performed Commit and Rollback can be performed to retrieve data. But after truncate statement, Commit and Rollback rollback statement cant be performed. Where condition can be used along with delete statement but it cant be used with truncate statement. Drop command is used to drop the table or keys like primary,foreign from a table.
33. What is the difference between Cluster and Non cluster Index?
A clustered index reorders the way records in the table are physically stored. There can be only one clustered index per table. It make data retrieval faster. A non clustered index does not alter the way it was stored but creates a complete separate object within the table. As a result insert and update command will be faster.
34. What is Union, minus and Interact commands?
MINUS operator is used to return rows from the first query but not from the second query. INTERSECT operator is used to return rows returned by both the queries.
Also Visit