Post on 18-Jan-2016
SQL Overview
Structured Query Language
Description
When Codd first described the theory of relational databases, he asserted that there should be a comprehensive language that would describe both the data and the meta data.
SQL has developed into that language
SQL Features
SQL does not come as a separate package
It is always a part of a Data Base Management system
SQL is a fourth generation language (meaning it is not procedural. You describe what you want to do not how to do it)
Standards
SQL is an ANSI standard Most DBMS implement the 1992
standard, some are beginning to implement the 1999 standard
In addition to the standard SQL most DBMSs add their own commands and features SQL Server has T-SQL Oracle has PSQL
Three Uses
To define data (including setting indexes and user permissions)
To query data To manipulate data
Data Definition
You can define all the data structures in a relational database with SQLCREATE TABLE tblCustomer ( CustomerID Integer Primary Key, CustomerLastName varchar(50), CustomerFirstName varchar(35) )
Data Query
You can retrieve any data or combination of the data from the database with SQL queriesSELECT CustomerLastName,
CustomerFirstname, OrderID, OrderDate
FROM tblCustomer cINNER JOIN tblOrder oON c.CustomerID=o.CustomerIDWHERE c.CustomerID=5;
Data Manipulation
You can Insert, Update and Manipulate data with SQL
UPDATE tblCustomerSET LastName=‘Smith’WHERE CustomerID=7;