Tuesday, June 16, 2015

Introduction to SQL

SQL:

SQL - Structured Query Language, is the language to query the database.

SQL is similar to English
 
You might be thinking that it is difficult to learn SQL.
But if you know how to speak English you can easily learn SQL.

Before learning how to write SQL, first we will try to convert our question into English.

Let's say, “Identify all the employees whose salary is greater than $10,000”

Identify – SELECT
all the employees – EmployeeID
Salary greater than $10,000 – Salary > 10000

Now we will try to convert our question into SQL query.

After combining all keywords into single statement:
SELECT EmployeeID Salary > 10000

Now only thing left for us is, where can we get this information that we can tell to SQL by using FROM clause.

After adding the clause our query becomes:

SELECT
        EmployeeID
FROM
       Employee
WHERE
       Salary > 10000

Here WHERE clause is used to provide the filtering criteria, and we need only those whose salary greater than 10000

Hope you understood how simple it is to write a query in SQL.

In next post we will try out different queries to get the information related to employees.


Labels: , , ,

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home