SQL Introductions

SQL Definition:

SQL is referred as Structured Query Language, a standard query language certified by ANSI and ISO. SQL is used to access different databases like SQL Server, MySQL, MS Access, Sybase, Oracle, DB2, Informix and Teradata etc.

SQL is a database computer language designed for the retrieval and management of data in a relational database. This tutorial will give you a quick push towards SQL database. It covers most of the topics required for a basic understanding of SQL and to get a feel of how it works.

What is need of SQL database?

  • It allow us to execute queries against a database.
  • It allow us to retrieve data from a database.
  • It allow us to insert records in a database.
  • It allow us to update records in a database.
  • It allow us to delete records from a database.
  • It allow us to create new databases.
  • It allow us to create new tables in a database.
  • It allow us to create stored procedures in a database.
  • It allow us to create views in a database.
  • It allow us to set permissions on tables, procedures, and views.

How to use SQL in our web Site?

SQL is just a query language, it is not a database. To perform SQL queries, you need to install any database, for example, Oracle, MySQL, MongoDB, PostGre SQL, SQL Server, DB2, etc.

RDBMS stands for Relational Database Management System.

RDBMS is the basis for SQL, and for all modern database systems such as MS SQL Server, IBM DB2, Oracle, MySQL, and Microsoft Access.

The data in RDBMS is stored in database objects called tables. A table is a collection of related data entries and it consists of columns and rows.

Syntax:


  • The syntax of a language describes the language elements.
  • SQL statements are somewhat like simple English sentences.
  • Keywords include SELECT, UPDATE, WHERE, ORDER BY, etc.
  • ANSI Standard SQL is the lingua franca for relational databases.

Basic Syntax of SQL:


SQL SELECT Statement


SELECT column1, column2....columnN
FROM   table_name;

SQL CREATE TABLE Statement


CREATE TABLE table_name(
column1 datatype,
column2 datatype,
column3 datatype,
.....
columnN datatype,
PRIMARY KEY( one or more columns )
);

SQL DROP TABLE Statement


DROP TABLE table_name;

SQL CREATE INDEX Statement


CREATE UNIQUE INDEX index_name
ON table_name ( column1, column2,...columnN);

SQL ALTER TABLE Statement


ALTER TABLE table_name {ADD|DROP|MODIFY} column_name {data_ype};



SQL INSERT INTO Statement


INSERT INTO table_name( column1, column2....columnN)
VALUES ( value1, value2....valueN);

SQL-Syntax-in-details