Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
5 views

SQL

Uploaded by

kvuit
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

SQL

Uploaded by

kvuit
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 22

SQL

SQL
• Structured Query Language
• SQL lets you access and manipulate databases
• SQL is the standard language for Relational Database
System.
• All the Relational Database Management Systems
(RDMS) like MySQL, MS Access, Oracle, Sybase,
Informix, Postgres and SQL Server use SQL as their
standard database language.
What Can SQL do?

• SQL can execute queries against a database


• SQL can retrieve data from a database
• SQL can insert ,delete,update records in a database
• SQL can create new databases
• SQL can create new tables in a database
• SQL can create stored procedures in a database
• SQL can create views in a database
• SQL can set permissions on tables, procedures, and
views
A Brief History of SQL

• 1970 − Dr. Edgar F. "Ted" Codd of IBM is known as the


father of relational databases. He described a relational
model for databases.
• 1974 − Structured Query Language appeared.
• 1978 − IBM worked to develop Codd's ideas and released
a product named System/R.
• 1986 − IBM developed the first prototype of relational
database and standardized by ANSI. The first relational
database was released by Relational Software which later
came to be known as Oracle
SQL Architecture
What is a table?

• The data in an RDBMS is stored in database objects


which are called as tables.
• This table is basically a collection of related data entries
and it consists of numerous columns and rows.
• A table is the most common and simplest form of data
storage in a relational database.
SQL Datatype
• SQL Data Type is an attribute that specifies the type of
data of any object.
Steps
SQL-SQL Commands
DDL - Data Definition Language

• DDL deals with database schemas and descriptions, of


how the data should reside in the database.
• CREATE – to create database and its objects like (table,
index, views, store procedure, function and triggers)
• ALTER – alters the structure of the existing database
• DROP – delete objects from the database
• TRUNCATE – remove all records from a table, including
all spaces allocated for the records are removed
• COMMENT – add comments to the data dictionary
• RENAME – rename an object
DML - Data Manipulation Language
• DML deals with data manipulation, and includes most
common SQL statements such SELECT, INSERT,
UPDATE, DELETE etc, and it is used to store, modify,
retrieve, delete and update data in database.
• SELECT – retrieve data from the a database
• INSERT – insert data into a table
• UPDATE – updates existing data within a table
• DELETE – Delete all records from a database table
• MERGE – UPSERT operation (insert or update)
• CALL – call a PL/SQL or Java subprogram
• EXPLAIN PLAN – interpretation of the data access path
• LOCK TABLE – concurrency Control
DCL - Data Control Language

• DCL includes commands such as GRANT, and mostly


concerned with rights, permissions and other controls of
the database system.
• GRANT – allow users access privileges to database
• REVOKE – withdraw users access privileges given by
using the GRANT command
TCL - Transaction Control Language

• TCL deals with transaction within a database.


• COMMIT – commits a Transaction
• ROLLBACK – rollback a transaction in case of any error
occurs
• SAVEPOINT – to roll back the transaction making points
within groups
• SET TRANSACTION – specify characteristics for the
transaction

You might also like