The SQL Language

Download Report

Transcript The SQL Language

The SQL Language
Presented by Reggie James, Isel
Liunoras, and Chris Rollins
Table of Contents
 What
is SQL?
 History
 Timeline
 Features
 Advantages/Disadvantages
 Programming Examples
 Conclusion
What Is SQL?

SQL stands for Structured Query Language
 SQL is a declarative language



Results in one statement of the desired result (i.e.
ML and Haskell)
Unlike procedural languages (many lines of code)
Used for RDBMS (Relational Database
Management System)
History of SQL
History of SQL
In 1970, Dr. E “Ted” Codd introduced the
relational model for databases
 In 1974, IBM started to develop System/R
(predecessor to SQL)
 In 1978, System/R released by IBM
 In 1982, IBM released SQL/DS and DB25
 The versions used today are SQL 89, SQL 92
and SQL 99. Most businesses are still using
SQL 92

Dr. E.F. “Ted” Codd
Relational Data Model
 Data
model used for business data
management
 In this model, data are organized into
tables
 The set of names of the columns is
called the schema of the table
Timeline of SQL
Features of SQL
Features of SQL
 Runs
queries of databases
 Exists on Windows and UNIX platforms
 There are different versions of SQL that
are still existing
 Backwards compatible
Disadvantages and Advantages
Disadvantages
 Code
cannot be reused
 Can’t link databases graphically
Advantages to SQL
 User
can customize query with
unlimited parameters
 Takes up less space than the GUI
interfaces such as: Access and Paradox
 Easy to learn
 High Productivity
 Integration with Oracle and Microsoft
Programming Examples
Programming Example
LOOP over each student record
IF this record has major = ‘Nutrition’ THEN
DELETE this record;
END IF;
END LOOP;
Another Programming Example
DECLARE
V_NewMajor VARCHAR2(10) := ‘History’;
V_FirstName VARCHAR2(10) := ‘Scott’;
v_LastName VARCHAR2(10) := ‘Urman’;
BEGIN
UPDATE students
SET major = v_NewMajor
WHERE first_name = v_LastName;
IF SQL%NOTFOUND THEN
INSERT INTO students (ID, first_name, last_name, major)
VALUES (student_sequence.NEXTVAL,v_FirstName,v_LastName, v_NewMajor);
END IF;
END;
Conclusion
 SQL is
a very powerful query language
provided that the user is familiar
 SQL is relatively easy to learn
 Upcoming product releases will change
the relative strengths of the database
management systems
 Making
it more powerful
 Making it more efficient