Tuesday, November 11, 2014

SQL Server SELECT Literal

SQL Server SELECT

SELECT statement is used to retrive data from database. In thus post we are going to execute our first SELECT statement 'Hello World!!! '.

Before going further we assume you have initial setup for this exercise. If not we recommend to read below post.


  • Install SQL Server
  • Open SQL Server Management Studio.
  • Connect to SQL Server and Open new query window. Execute a test query.
  • Add sample database.

We assume you opened SSMS, and query window is opened.


In your opened query window execute below command

SELECT 'Hello World!!! ';

Output

What happened here in this example We use SELECT statement to retrive data from literal. So what is literal?Literals are strings are number.

What we learn from this
SELECT statement is used to retrive data from different database objects such as database table or literals. So if you are thinking SELECT statement is used only to bring data from database take than it is wrong.


Below are some more example of SELECT statement with literals.

SELECT 1947;
SELECT 'Hello'+'1';

Now I suggest keep practicing with literals and share your experience with me.

In our next post we are going to use SELECT statement with a database table



No comments:

Post a Comment