Other related articles:

Recently viewed articles:

SQL Introduction

Structured Query Language, most often called (S-Q-L), is Database Query Language used to manipulate and extract data from Database. It was originally called Structured English Query Language (in short SEQUEL) by IBM. But after sometime IBM found that SEQUEL was a trademark for UK based Hawker Siddeley Aircraft Company, it dropped word “English” and acronym was change to SQL. SQL Syntax is a simple English statement, thus makes SQL based queries one of the most easy to understand and learn.
SQL is based on declarative approach which makes it different from other computer language (usually procedural approach). In SQL, we write what we need and system itself finds the best procedure to get that information. On the other hand, in procedural approach we have to define how to get that information.
SQL is used:

  • to create database schema and its objects.
  • to store data into these objects.
  • to manipulate the stored data.
  • to retrieve data from database.
  • To control security of database.

The way SQL interacts with database is shown in figure below:
http://sqlqueryexamples.com/sql-query-examples/wp-content/uploads/2012/07/intro.jpg
Database Management System (most often called DBMS) is a system which controls database. SQL is used to make request to DBMS, then DBMS analyze the request and returns data specific to that request. This whole process is called query.
Data is basically stored in the form of table (rows and columns). The following example shows a very simple form of table.
EMP


EMPNO

ENAME

SAL

JOB

DEPTNO

4621

RAJ

1000

SALESPERSON

10

4852

SMITH

5000

MANAGER

10

4932

SCOTT

2000

CLERK

20

: where EMP is a table name. EMPNO, ENAME, SAL and so on are column names, also called attributes. Each row in a table represents one record.
A simple SQL query to this database could be:
                                        SELECT ename FROM emp;

  • SELECT is SQL keyword which tells DBMS to select some data.
  • Ename is a column name, as shown is table above.
  • FROM is again SQL keyword which tells DBMS the table name from where to fetch data.
  • Emp is a table name for above table