STRUCTURED QUERY
LANGUAGE
RASHID ANSARI
170847980003
MTECH(ACDS)
SQL
 Structure Query Language(SQL) is a programming language used for storing and
managing data in RDBMS.
 SQL was the first commercial language introduced for E.F Codd's Relational
model.
 Today almost all RDBMS(MySql, Oracle, Infomix, Sybase,MS Access) uses SQL as
the standard database language.
 SQL is used to perform all type of data operations in RDBMS.
STRUCTURED QUERY LANGUAGE
 Structured Query Language (SQL) is the language standardized by the American
National Standards Institute (ANSI) and the International Organization for
Standardization (ISO) for use on relational databases.
 It is a declarative rather than procedural language, which means that users declare
what they want without having to write a step-by-step procedure.
 The SQL language was first implemented by the Oracle Corporation _in 1979, with
various versions of SQL being released since then.
COMMANDS
 TYPES OF COMMANDS
 DATA DEFINITION LANGUAGE (DDL)
 DATA MANIPULATION LANGUAGE (DML)
 DATA CONTROL LANGUAGE (DCL)
 TRANSACTION CONTROL LANGUAGE (TCL)
DATA DEFINITION LANGUAGE
 DDL is short name of Data Definition Language, which 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
DATA MANIPULATION LANGUAGE
 DML is short name of Data Manipulation Language which 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 a database.
 SELECT – retrieve data from a database
 INSERT – insert data into a table
 UPDATE – updates existing data within a table
 DELETE – Delete all records from a database table
DATA CONTROL LANGUAGE
 DCL is short name of Data Control Language which 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
TRANSACTION CONTROL LANGUAGE
 TCL is short name of Transaction Control Language which deals with a transaction
within a database.
 COMMIT – commits a Transaction
 ROLLBACK – rollback a transaction in case of any error occurs
 SAVEPOINT – to rollback the transaction making points within groups
COMMANDS EXAMPLE’S
 DDL COMMANDS
 Creating a database
create database Sample;
Above command will create a database named Sample
 Creating a table
create table student(id int,name varchar, age int);
Above command will create a new table student in database system with 3 columns,namely
id,name and age.
COMMANDS EXAMPLE’S
 DML
 Inserting a record in a table
Insert into student values(100,’Kale’,15);
Above command will insert a record into student table.
 Updating a record
Update student set age=11 where s_id=100;
Above command will update the record of student having id 102 and change his age to 18.
ADVANTAGES
 SQL Queries can be used to retrieve large amounts of records from a database
quickly and efficiently.
 SQL is used to view the data without storing the data into the object.
 SQL joins two or more tables and show it as one object to user.
 SQL databases use long-established standard, which is being adopted by ANSI
& ISO. Non-SQL databases do not adhere to any clear standard.
 Using standard SQL it is easier to manage database systems without having to
write substantial amount of code.
 SQL restricts the access of a table so that nobody can insert the rows into the table.
DISADVANTAGES
 Interfacing an SQL database is more complex than adding a few lines of code.
 When table is dropped view becomes inactive. It depends on the table objects.
 Although SQL databases conform to ANSI & ISO standards, some databases
go for proprietary extensions to standard SQL to ensure vendor lock-in.
 It is an object so it occupies space.
THANKYOU

Structured query language

  • 1.
  • 2.
    SQL  Structure QueryLanguage(SQL) is a programming language used for storing and managing data in RDBMS.  SQL was the first commercial language introduced for E.F Codd's Relational model.  Today almost all RDBMS(MySql, Oracle, Infomix, Sybase,MS Access) uses SQL as the standard database language.  SQL is used to perform all type of data operations in RDBMS.
  • 3.
    STRUCTURED QUERY LANGUAGE Structured Query Language (SQL) is the language standardized by the American National Standards Institute (ANSI) and the International Organization for Standardization (ISO) for use on relational databases.  It is a declarative rather than procedural language, which means that users declare what they want without having to write a step-by-step procedure.  The SQL language was first implemented by the Oracle Corporation _in 1979, with various versions of SQL being released since then.
  • 4.
    COMMANDS  TYPES OFCOMMANDS  DATA DEFINITION LANGUAGE (DDL)  DATA MANIPULATION LANGUAGE (DML)  DATA CONTROL LANGUAGE (DCL)  TRANSACTION CONTROL LANGUAGE (TCL)
  • 5.
    DATA DEFINITION LANGUAGE DDL is short name of Data Definition Language, which 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
  • 6.
    DATA MANIPULATION LANGUAGE DML is short name of Data Manipulation Language which 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 a database.  SELECT – retrieve data from a database  INSERT – insert data into a table  UPDATE – updates existing data within a table  DELETE – Delete all records from a database table
  • 7.
    DATA CONTROL LANGUAGE DCL is short name of Data Control Language which 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
  • 8.
    TRANSACTION CONTROL LANGUAGE TCL is short name of Transaction Control Language which deals with a transaction within a database.  COMMIT – commits a Transaction  ROLLBACK – rollback a transaction in case of any error occurs  SAVEPOINT – to rollback the transaction making points within groups
  • 9.
    COMMANDS EXAMPLE’S  DDLCOMMANDS  Creating a database create database Sample; Above command will create a database named Sample  Creating a table create table student(id int,name varchar, age int); Above command will create a new table student in database system with 3 columns,namely id,name and age.
  • 10.
    COMMANDS EXAMPLE’S  DML Inserting a record in a table Insert into student values(100,’Kale’,15); Above command will insert a record into student table.  Updating a record Update student set age=11 where s_id=100; Above command will update the record of student having id 102 and change his age to 18.
  • 11.
    ADVANTAGES  SQL Queriescan be used to retrieve large amounts of records from a database quickly and efficiently.  SQL is used to view the data without storing the data into the object.  SQL joins two or more tables and show it as one object to user.  SQL databases use long-established standard, which is being adopted by ANSI & ISO. Non-SQL databases do not adhere to any clear standard.  Using standard SQL it is easier to manage database systems without having to write substantial amount of code.  SQL restricts the access of a table so that nobody can insert the rows into the table.
  • 12.
    DISADVANTAGES  Interfacing anSQL database is more complex than adding a few lines of code.  When table is dropped view becomes inactive. It depends on the table objects.  Although SQL databases conform to ANSI & ISO standards, some databases go for proprietary extensions to standard SQL to ensure vendor lock-in.  It is an object so it occupies space.
  • 13.