Sql Introduction

SQL stands for Structured Query Language. Structure Query Language(SQL) is a database query language used for storing and managing data in Relational DBMS. SQL was the first commercial language introduced Relational model of database. Today almost all RDBMS(MySql, Oracle, Infomix, Sybase, MS Access) use SQL as the standard database query language. SQL is used to perform all types of data operations in RDBMS.SQL allows users to query the database .

Characteristics Of SQL

  • SQL is easy to learn.
  • SQL is used to access data from relational database management systems.
  • SQL can execute queries against the database.
  • SQL is used to define the data in the database and manipulate it when needed.
  • SQL is used to create and drop the database and table.
  • SQL is used to create a view, stored procedure, function in a database.

SQL follows the following rules:

  • SQL is not case sensitive. Generally, keywords of SQL are written in uppercase.
  • SQL statements are dependent on text lines. We can use a single SQL statement on one or multiple text line.

SQL Commands

SQL defines following ways to manipulate data stored in an RDBMS.

1. Data definition language (DDL)

DDL changes the structure of the table like creating a table, deleting a table, altering a table, etc.

Here are some commands that come under DDL:

CREATE  : To create new table or database

Syntax : CREATE TABLE TABLE_NAME (COLUMN_NAME DATATYPES[,….]);

ALTER : For alteration

Syntax : ALTER TABLE table_name ADD column_name COLUMN-definition;

DROP : To drop a table

Syntax :   DROP TABLE ;

TRUNCATE : Delete from table

Syntax : TRUNCATE TABLE table_name;

2.Data Manipulation Language(DML)

DML commands are used to modify the database.

Here are some commands that come under DML:

INSERT

Syntax :

INSERT INTO TABLE_NAME  (col1, col2, col3,…. col N)  VALUES (value1, value2, value3, …. valueN);

UPDATE

Syntax :

UPDATE table_name SET [column_name1= value1,…column_nameN = valueN] [WHERE CONDITION]

DELETE

Syntax :

DELETE FROM table_name [WHERE condition];

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *