Tutorials » SqlServer tutorials »

Examples of SQL Statements


This chapter talks about some of the most commonly used SQL statements.


As you already know by now, SQL is the language used to communicate with database systems. To execute commands on a database, you will compose SQL statements and send to a database or database server. The database system will parse the SQL statement and execute.

What is SQL Statement ?


An SQL statement represents a set of commands that can be executed by a database system. Here is a sample SQL statement:

select name from employee where age > 20


The above SQL statement will find the name of all employees from the EMPLOYEE table whoes Age is above 20. The words marked in blue color are keywords.

Let us break the statement into 3 sections:

select name - SELECT is a keyword and NAME represents the database field to select.

from employee - FROM is a keyword and EMPLOYEE represents the database table to select data from.

where age > 20 - WHERE is a keyword and AGE > 20 is the condition based on which the records are selected from the table.

Basically, the select statement has the following syntax:

SELECT [FIELD 1, FIELD 2, ...] FROM [TABLE NAME] WHERE [CONDITION]

The WHERE condition is optional. If there is no WHERE condition, then the sql statement will return all the records from the table.

In the next chapter, you will learn about the other types of SQL statements.



Next Chapter: Connecting to SQL Server Database using Management Studio
Previous Chapter: CRUD Operation
More Chapters: Sql Server Tutorials
More Tutorials: Tutorial Index



Subscribe to Subscribers
Top Contributors
TodayLast 7 Daysmore...

Awards & Gifts

Online Members

Ameer Ali
More...
 
Copyright © SpiderWorks Technologies Pvt Ltd., Kochi, India