Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Download
Standard view
Full view
of .
Look up keyword or section
Like this
15Activity

Table Of Contents

0 of .
Results for:
No results containing your search query
P. 1
SQL Tutorial

SQL Tutorial

Ratings: (0)|Views: 135|Likes:
Published by dirtyharrydeepak
Complete
Complete

More info:

Published by: dirtyharrydeepak on Apr 10, 2010
Copyright:Attribution Non-commercial

Availability:

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

10/25/2011

pdf

text

original

 
Sql Tutorial
SQL is a standard language for accessing databases.Our SQL tutorial will teach you how to use SQL to access and manipulate datain:MySQL, SQL Server, Access, Oracle, Sybase, DB2, and other database systems.
SQL Syntax
SELECT Company, Country FROM Customers WHERE Country <> 'USA'
SQL Result
 
Company Country
I
sland Trading UKGalería del gastrónomo SpainLaughing Bacchus Wine Cellars CanadaParis spécialités France
 
Simons bistro DenmarkWolski Zajazd Poland
Introduction
SQL is a standard language for accessing and manipulating databases.
What is SQL?
y
 
SQL stands for Structured Query Language
y
 
SQL lets you access and manipulate databases
y
 
SQL is an ANS
I
(American National Standards
I
nstitute) standard
What Can SQL do?
y
 
SQL can execute queries against a database
y
 
SQL can retrieve data from a database
y
 
SQL can insert records in a database
y
 
SQL can update records in a database
y
 
SQL can delete records from a database
y
 
SQL can create new databases
y
 
SQL can create new tables in a database
 
y
 
SQL can create stored procedures in a database
y
 
SQL can create views in a database
y
 
SQL can set permissions on tables, procedures, and views
SQL is a Standard - BUT....
Although SQL is an ANS
I
(American National Standards
I
nstitute) standard, there are many differentversions of the SQL language.However, to be compliant with the ANS
I
standard, they all support at least the major commands (suchas SELECT, UPDATE, DELETE,
I
NSERT, WHERE) in a similar manner.
N
ote:
Most of the SQL database programs also have their own proprietary extensions in addition tothe SQL standard!
Using SQL in Your Web Site
To build a web site that shows some data from a database, you will need the following:
y
 
An RDBMS database program (i.e. MS Access, SQL Server, MySQL)
y
 
A server-side scripting language, like PHP or ASP
y
 
SQL
y
 
HTML / CSS
RDBMS
RDBMS stands for Relational Database Management System.RDBMS is the basis for SQL, and for all modern database systems like MS SQL Server,
I
BM DB2,Oracle, MySQL, and Microsoft Access.The data in RDBMS is stored in database objects called tables.A table is a collections of related data entries and it consists of columns and rows.
SQLSyntax 
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":
P_Id
Last
N
ame First
N
ame A
dd
ress City
1
Hansen Ola Timoteivn
10
Sandnes2 Svendson Tove Borgvn 23 Sandnes3 Pettersen Kari Storgt 2
0
Stavanger
 
The table above contains three records (one for each person) and five columns (P_
I
d, LastName,FirstName, Address, and City).
SQL Statements
Most of the actions you need to perform on a database are done with SQL statements.The following SQL statement will select all the records in the "Persons" table:
SELECT * FROM Persons
I
n this tutorial we will teach you all about the different SQL statements.
Keep in Mind That...
y
 
SQL is not case sensitive
Semicolon after SQL Statements?
Some database systems require a semicolon at the end of each SQL statement.Semicolon is the standard way to separate each SQL statement in database systems that allow morethan one SQL statement to be executed in the same call to the server.We are using MS Access and SQL Server 2
000
and we do not have to put a semicolon after each SQLstatement, but some database programs force you to use it.
SQL DML and DDL
SQL can be divided into two parts: The Data Manipulation Language (DML) and the Data DefinitionLanguage (DDL).The query and update commands form the DML part of SQL:
y
 
SE
L
E
CT
- extracts data from a database
y
 
U
PD
AT
E
- updates data in a database
y
 
D
E
L
E
T
E
- deletes data from a database
y
 
IN
SER 
T
IN
TO
- inserts new data into a databaseThe DDL part of SQL permits database tables to be created or deleted.
I
t also define indexes (keys),specify links between tables, and impose constraints between tables. The most important DDLstatements in SQL are:
y
 
C
RE
AT
E
 
D
ATABA
SE
- creates a new database
y
 
ALT
ER 
 
D
ATABA
SE
- modifies a database
y
 
C
RE
AT
E
TABL
E
- creates a new table
y
 
ALT
ER 
TABL
E
- modifies a table
y
 
D
O
P
TABL
E
- deletes a table
y
 
C
RE
AT
E
 
IND
EX
- creates an index (search key)
y
 
D
O
P
 
IND
EX
- deletes an index

Activity (15)

You've already reviewed this. Edit your review.
1 thousand reads
1 hundred reads
Mani Vannan liked this
Jarnail Singh liked this
aravinda_krishna liked this
shubh198612345 liked this
Rahulk_rana liked this
sivalingamece liked this
Yusri Nugraha liked this

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)//-->