Question: what is the difference between query and stored procedure?
Answer: SQL query and Stored procedure do the same thing. But the difference is that, a query should be compiled every time the query is executed, while the stored procedure is in compiled form when executed first time. If we use stored procedure we can avoid recompilation of the query.