The full form of SQL is structured query language. The SQL is a standard language for the accessing and manipulating the database. This is a language of ANSI (American national standard institute) standard one. By using this language we can execute queries against the database. We can retrieve data from the database, we insert records in a database, we can delete records from the database, we can update records from the database, we can create new database, we can create store procedures in the database, and we can set up permissions on tables, procedures and views.

The basic concept needed for SQL is RDBMS (Relational Database Management System) and even for all the database systems. RDBMS data is stored in Table form where a Table is a collection of records. Record is a collection of Rows and Columns. Most of the database tables contain 1 or more tables. Every table is identified with it specific name. The actions performed on the database are done by sql statement that is nothing but queries.

Structured query language is a case sensitive. Some database language query should be ended with the semicolon. But for SQL server2000 and MS access doesn’t need semicolon at the end of the query.

Structured query language (SQL) has classified into 2 parts:

1.Datamanupulation Language(DML)

2.Data Definition Language(DDL)

 1. Datamanupulation Language(DML) commands for writing a query:

 a. Select command –

          Select command is used to extract selected data from the database.

b.Update command-

         Update command is used to update the data in the database.

c.Delete command –

         Delete command is used to Delete the data in the database.

d.Insert command –

         Insert command is used to insert new data in the database.

2. Data definition Language (DDL):

 In SQL, DDL commands permits the database to create and update the tables. The DDL commands are:

 a. Create Database command –

           This command is used to create a new database.

b. Alter Database command –

           This command is used to modify database.

c. Create Table command –

           This command is used to create a new table.

 d. Alter Table command –

           This command is used to modify tables.

e.  Drop table command –

          This command is used to delete Table.

f. Drop index command –

           This command is used to delete an index.


1. The select statements:

         The data from the database can be selected by using select statement of sql. This result of the sql statement will be stored in result- set.


Select column_name from table_name


Select * from table_name

2.       Select distinct statement:

A table may contain duplicate values in the column. We can list only distinct values by using select distint statement.


Select Distinct colum_nname from table_name

3.   Select where clause:

To extract particular data from the table we can use where clause.


Select column_name from table_name where column_name operator value.

The operators allowed in the where clause :

1. = equal

2. >< Not equal

3. > Greater than

4. < Less than

5.   >=greater than or equal

6. <= Less than or equal

7. BETWEEN – Between an inclusive range.

8. LIKE – to Search for the pattern

9. IN – to return the exact value for a column.

4.  And & or operator:

The records can be filtered using a condition by using And & or operator. If first condition and the second condition is true, then the And operator displays the record. If the first condition or the second condition is true then the Or operator displays the record.


Select * from table_name where column_name= value And Column_name= Value

5. Orderby Clause:

OrderBy clause is used to sort the result set. We can sort the record by using orderby clause command. We can sort the record in ascending order and descending order. The default of sorting the record is ascending order.


Select column_name from table_name orderby column_name Asc|Dec

6.Insert inti statement:

To insert new record into the table Insert Into command is used. There are two forms of insert into command.

To insert only values


Insert into Table_Name Values (value1, value2, value3……………..)

To insert both columns and values


Insert into table_name( column1, column2, column3……………..) values(value1,value2,value3………)

7.Update statement:

To update the existing records in a table we can use update statement.


Update table_name SET column1 = value, column2= value...where some_column = some_value

If the where clause is omitted then all the columns in the records gets updated.

8.Delete statement:

To delete record in the table, we can use delete statement.


Delete from table_name where some _column= some_value








Like it on Facebook, Tweet it or share this article on other bookmarking websites.

No comments