Presentation is loading. Please wait.

Presentation is loading. Please wait.

Copyright © 2003-2008 Curt Hill SQL The Intergalactic Standard Database Query Language.

Similar presentations


Presentation on theme: "Copyright © 2003-2008 Curt Hill SQL The Intergalactic Standard Database Query Language."— Presentation transcript:

1 Copyright © 2003-2008 Curt Hill SQL The Intergalactic Standard Database Query Language

2 What is it? Abbreviation of Structured Query Language Official pronunciation is spelled out S – Q – L Official as in from ISO/ANSI Often pronounced See-Quell Both work in this class Copyright © 2003-2008 Curt Hill

3 Why SQL? A major strength of the relational model: supports simple, powerfulqueryingof data. Queries can be written intuitively, and the DBMS is responsible for efficient evaluation. – Precise semantics for relational queries. – Allows the optimizer to extensively re- order operations – Provided the answer does not change.

4 SQL – a requirement? A database does not need to offer SQL interpretation to be a classified as relational Commercially it is mostly a requirement Notice the names of some: –SQL-Server –MySql Copyright © 2003-2008 Curt Hill

5 History Developed by IBM in system R –1974 – 1977 –Originally called SEQUEL for Structured English QUEry Language Used in some variation by all major relational DBs Standards: – SQL-86 – SQL-89 (minor revision) – SQL-92 (major revision) AKA SQL2 – SQL-1999 (major extensions) AKA SQL3 – SQL-2003 – SQL-2006 – SQL-2008

6 Standard? SQL is one of the least standardized common languages Why? Queries are specific to a single database –They must take into account table names and field names –Organizations have databases that contain data peculiar to them –Even similar databases will vary with regard to table and field names Copyright © 2003-2008 Curt Hill

7 Variants It seems that each major database has its variants Accepts the basic language but: –Leaves out some pieces –Adds proprietary extensions We will try to examine the variations of the three major ones: –Oracle 10 –SQL Server –MySQL Copyright © 2003-2008 Curt Hill

8 ODBC Online Data Base Connectivity Take commands from program Connect to a SQL based DB on the net ODBC handles two aspects: –The TCP/IP connection –Converting their SQL to the variant handled by this particular database and the format of the returned data JDBC –Java interface to ODBC Copyright © 2003-2008 Curt Hill

9 Parts of the language Data Manipulation Language (DML) –This subset was influenced by the relational algebra and relational calculus –Gives us facility to: Generate queries Insert records Delete records Modify records Data Definition Language (DDL) –Used to define, update and delete databases, tables and views

10 Copyright © 2003-2008 Curt Hill Faculty load query (calculus) Consider a sample query from the calculus { |  naid,dp,dg,ar,title(  Faculty)   Course   Faculty_Teach )}

11 Copyright © 2003-2008 Curt Hill Faculty load query (SQL) Select f.name, c.dept, c.number, c.crhr From faculty as f, course as c, faculty_teach as ft Where f.naid=ft.naid AND ft.dept = c.dept AND ft.number = c.number Select is algebra or calculus From is set membership (calculus) Where is the implied equalities (calculus)


Download ppt "Copyright © 2003-2008 Curt Hill SQL The Intergalactic Standard Database Query Language."

Similar presentations


Ads by Google