Upload
johnathan-barker
View
215
Download
2
Embed Size (px)
Citation preview
THE RELATIONAL DATA BASE (RDB) AND STRUCTURED QUERY LANGUAGE (SQL)
• Based on relational theory
• Relational model first introduced by Dr. E.F Codd in early 70s
• First prototype system developed by IBM in the mid 70s
• First commercial version from ORACLE in 1979
History:
THE RELATIONAL DATA BASE (RDB) AND STRUCTURED QUERY LANGUAGE (SQL)
• RDBs are now the standard for data storage
• SQL is the standard for accessing and manipulating RDBs
• SQL is an ANSI standard in the public domain
• SQL is implemented by many vendors including all major
data base systems
Current status:
Description of an RDB:
• Data stored in related tables
• Tables made up of rows and columns
• Rows in are uniquely identified by a primary key
• Rows in different tables are related by a foreign key
• Non-procedural
• Works on an entire set of data at a time
• Has English like syntax
• Very concise and powerful
• Combines functionality of the data step and
several procedures into a single statement
Description of SQL:
DNAME LOC DEPTNO
ACCOUNTING NEW YORK 10
RESEARCH DALLAS 20
SALES CHICAGO 30
OPERATIONS BOSTON 40
EMPNO ENAME JOB MGR HIREDATE SAL DEPTNO COMM
7369 SMITH CLERK 7902 17DEC80 $800 20 .
7499 ALLEN SALESMAN 7698 20FEB81 $1,600 30 $300
7521 WARD SALESMAN 7698 22FEB81 $1,250 30 $500
7566 JONES MANAGER 7839 02APR81 $2,975 20 .
7654 MARTIN SALESMAN 7698 28SEP81 $1,250 30 $1,400
7698 BLAKE MANAGER 7839 01MAY81 $2,850 30 .
7782 CLARK MANAGER 7839 09JUN81 $2,450 10 .
7788 SCOTT ANALYST 7566 19APR87 $3,000 20 .
7839 KING PRESIDENT . 17NOV81 $5,000 10 .
7844 TURNER SALESMAN 7698 08SEP81 $1,500 30 $0
7876 ADAMS CLERK 7788 23MAY87 $1,100 20 .
7900 JAMES CLERK 7698 03DEC81 $950 30 .
7902 FORD ANALYST 7566 03DEC81 $3,000 20 .
7934 MILLER CLERK 7782 23JAN82 $1,300 10 .
EMP Table (Detail table)
DEPT Table (Mater table)
1
*
A ONE-TO-MANY RELATIONSHIP
PK
PK
FK
SELECT variable list FROM table list;
STRUCTURE OF SQL SELECT STATEMENT SYNTAX
SELECT variable list FROM table list WHERE condition;
SELECT variable list FROM table list WHERE conditionORDER BY variable list;
SELECT variable list FROM table list WHERE condition
GROUP BY variable list HAVING condition
ORDER BY variable list;