Description:
#sqlinterviewquestionsandanswers
sql query interview question difference between select and print statement
The `SELECT` statement retrieves data from a database and displays it in a result set, used for querying information. On the other hand, the `PRINT` statement outputs messages or variable values to the "Messages" tab in SQL Server Management Studio, primarily for debugging or providing informational messages during script execution. While `SELECT` produces a result set containing data, `PRINT` is used for displaying non-result set information in the Messages tab. They serve distinct purposes in SQL scripting and are employed based on the need for data retrieval or message display.
in short select statement output will display in the result window, whereas print statement output will display in the message window in SQL Server management studio
here is another sql query case statement multiple condition display greetings from current time.
Using a SQL `CASE` statement with multiple conditions, display a personalized greeting based on the current time. Different greetings can be shown for morning, afternoon, evening, and night, providing a dynamic response depending on the time of day.
Share this link via
Or copy link




























