Introduction to SQL
SQL stands for Structured Query Language.SQL is a standard computer language for accessing and manipulating databases. SQL is short for Structured Query Language and is a widely used database language, providing means of data manipulation (store, retrieve, update, delete) and database creation.SQL can execute queries,can retrieve data,insert,delete or update records in a database. SQL is an ANSI standard computer language
Almost all modern Relational Database Management Systems like MS SQL Server,Microsoft Access, MSDE, Oracle, DB2, Sybase, MySQL, Postgres and Informix use SQL as standard database language.
Database Tables in SQL
The foundation of every Relational Database Management System is a
database object called table. Every database consists of one or more tables,
which store the database’s data/information. Each table has its own unique
name and consists of columns and rows.
The database table columns (called also table fields) have their own unique
names and have a pre-defined data types. Table columns can have various
attributes defining the column functionality (the column is a primary key,
there is an index defined on the column, the column has certain default value,
etc.).
While table columns describe the data types, the table rows contain the actual
data for the columns.
SQL Data Manipulation Language (DML)
SQL (Structured Query Language) is a syntax for executing queries. But the SQL
language also includes a syntax to update, insert, and delete records.
These query and update commands together form the Data Manipulation Language
(DML) part of SQL:
· SELECT – select data from a database table
· UPDATE – updates data in a database table
· DELETE – deletes data from a database table
· INSERT INTO – inserts new data into a database table
SQL Data Definition Language (DDL)
The Data Definition Language (DDL) of SQL allow us to create,alter or delete database objects such as tables,indexes etc. indexes (keys), specify links between tables, and impose
constraints between database tables.
The most important DDL statements in SQL are listed below:
· CREATE TABLE – creates a new database table
· ALTER TABLE – alters a database table
· DROP TABLE – delete a database table
· CREATE INDEX – creates a new index (search key)
· DROP INDEX – deletes an existing index