Welcome to Scribd. Sign in or start your free trial to enjoy unlimited e-books, audiobooks & documents.Find out more
Download
Standard view
Full view
of .
Look up keyword
Like this
1Activity
0 of .
Results for:
No results containing your search query
P. 1
SQL_Tutorial

SQL_Tutorial

Ratings: (0)|Views: 6|Likes:
Published by api-3697145

More info:

Published by: api-3697145 on Oct 16, 2008
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as DOC, PDF, TXT or read online from Scribd
See more
See less

05/09/2014

pdf

text

original

SQL Tutorial
SQL Tutorial
SQL is a standard computer language for accessing and
manipulating databases.

In this tutorial you will learn how to use SQL to access and
manipulate data in Oracle, Sybase, SQL Server, DB2, Access, and
other database systems.

Introduction to SQL
SQL is a standard computer language for accessing and manipulating databases.
What is SQL?
\u2022
SQL stands forStructuredQueryLanguage
\u2022
SQL allows you to access a database
\u2022
SQL is an ANSI standard computer language
\u2022
SQL can execute queries against a database
\u2022
SQL can retrieve data from a database
\u2022
SQL can insert new records in a database
\u2022
SQL can delete records from a database
\u2022
SQL can update records in a database
\u2022
SQL is easy to learn
SQL is a Standard - BUT....

SQL is an ANSI (American National Standards Institute) standard computer language for accessing
and manipulating database systems. SQL statements are used to retrieve and update data in a
database. SQL works with database programs like MS Access, DB2, Informix, MS SQL Server,
Oracle, Sybase, etc.

Unfortunately, there are many different versions of the SQL language, but to be in compliance with
the ANSI standard, they must support the same major keywords in a similar manner (such as
SELECT, UPDATE, DELETE, INSERT, WHERE, and others).

Note: Most of the SQL database programs also have their own proprietary extensions in addition to
the SQL standard!
SQL Database Tables
A database most often contains one or more tables. Each table is identified by a name (e.g.
"Customers" or "Orders"). Tables contain records (rows) with data.
Below is an example of a table called "Persons":
LastName
FirstName
Address
City
Hansen
Ola
Timoteivn 10
Sandnes
Svendson
Tove
Borgvn 23
Sandnes
Pettersen
Kari
Storgt 20
Stavanger
The table above contains three records (one for each person) and four columns (LastName,
FirstName, Address, and City).
SQL Queries
With SQL, we can query a database and have a result set returned.
A query like this:
SELECT LastName FROM Persons
Gives a result set like this:
LastName

Hansen
Svendson
Pettersen

Note: Some database systems require a semicolon at the end of the SQL statement. We don't use
the semicolon in our tutorials.
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:\u2022
SELECT - extracts data from a database table
\u2022
UPDATE - updates data in a database table
\u2022
DELETE - deletes data from a database table
\u2022
INSERT INTO - inserts new data into a database table
SQL Data Definition Language (DDL)

The Data Definition Language (DDL) part of SQL permits database tables to be created or deleted. We can also define indexes (keys), specify links between tables, and impose constraints between database tables.

The most important DDL statements in SQL are:
\u2022
CREATE TABLE - creates a new database table
\u2022
ALTER TABLE - alters (changes) a database table
\u2022
DROP TABLE - deletes a database table
\u2022
CREATE INDEX - creates an index (search key)
\u2022
DROP INDEX - deletes an index
Introduction to SQL
SQL is a standard computer language for accessing and manipulating databases.
What is SQL?
\u2022
SQL stands forStructuredQueryLanguage
\u2022
SQL allows you to access a database
\u2022
SQL is an ANSI standard computer language
\u2022
SQL can execute queries against a database
\u2022
SQL can retrieve data from a database
\u2022
SQL can insert new records in a database
\u2022
SQL can delete records from a database
\u2022
SQL can update records in a database
\u2022
SQL is easy to learn
SQL is a Standard - BUT....

SQL is an ANSI (American National Standards Institute) standard computer language for accessing
and manipulating database systems. SQL statements are used to retrieve and update data in a
database. SQL works with database programs like MS Access, DB2, Informix, MS SQL Server,
Oracle, Sybase, etc.

Unfortunately, there are many different versions of the SQL language, but to be in compliance with
the ANSI standard, they must support the same major keywords in a similar manner (such as
SELECT, UPDATE, DELETE, INSERT, WHERE, and others).

Note: Most of the SQL database programs also have their own proprietary extensions in addition to
the SQL standard!
SQL Database Tables
A database most often contains one or more tables. Each table is identified by a name (e.g.
"Customers" or "Orders"). Tables contain records (rows) with data.
Below is an example of a table called "Persons":
LastName
FirstName
Address
City
Hansen
Ola
Timoteivn 10
Sandnes
Svendson
Tove
Borgvn 23
Sandnes
Pettersen
Kari
Storgt 20
Stavanger

You're Reading a Free Preview

Download
scribd
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->