Les00 Intoduction

1,406 views

Published on

Published in: Travel
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
1,406
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
156
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Les00 Intoduction

  1. 1. Introduction<br />
  2. 2. Objectives<br />After completing this lesson, you should be able to do the following: <br />Discuss the theoretical and physical aspects of a relational database<br />Describe the Oracle implementation of the RDBMS and ORDBMS<br />Describe how SQL and PL/SQL are used in the Oracle product set<br />Describe the use and benefits of PL/SQL<br />
  3. 3. System Development Life Cycle<br />Strategy<br />and<br />Analysis<br />Design<br />Build<br />and<br />Document<br />Transition<br />Production<br />
  4. 4. System Development Life Cycle<br />Strategy<br />and<br />Analysis<br />Design<br />Build<br />and<br />Document<br />Transition<br />Production<br />
  5. 5. Data Storage on Different Media<br />Database<br />Electronic spreadsheet<br />Filing cabinet<br /> SALGRADE<br /> GRADE LOSAL HISAL<br />--------- --------- ---------<br />17001200<br />212011400<br />314012000<br />420013000<br />530019999<br />DEPT<br /> DEPTNO DNAME LOC<br />--------- -------------- ---------- 10 ACCOUNTING NEW YORK<br />20 RESEARCH DALLAS<br />30 SALES CHICAGO<br />40 OPERATIONS BOSTON<br />
  6. 6. Relational Database Concept<br />Dr. E. F. Codd proposed the relational model for database systems in 1970.<br />It is the basis for the relational database management system (RDBMS).<br />The relational model consists of the following:<br />Collection of objects or relations<br />Set of operators to act on the relations<br />Data integrity for accuracy and consistency<br />
  7. 7. Table Name: DEPT<br />Table Name: EMP<br />DEPTNO DNAME LOC<br />10 ACCOUNTING NEW YORK<br />20 RESEARCH DALLAS<br />30 SALES CHICAGO<br />40 OPERATIONS BOSTON<br />EMPNO ENAME JOB DEPTNO<br />7839 KING PRESIDENT10<br />7698 BLAKE MANAGER30<br />7782 CLARK MANAGER 10<br />7566 JONES MANAGER20<br />Definition of a Relational Database<br />A relational database is a collection of relations or two-dimensional tables.<br />Database<br />
  8. 8. Data Models<br />Server<br />Model ofsystemin client’smind<br />Entity model ofclient’s model<br />Table modelof entity model<br />Tables on disk<br />
  9. 9. <ul><li>Create an entity relationship diagram from business specifications or narratives
  10. 10. Scenario
  11. 11. “. . . Assign one or more employees to a department . . .”
  12. 12. “. . . Some departments do not yet have assigned employees . . .”</li></ul>Entity Relationship Model<br />DEPARTMENT<br />#* number<br />* name<br />olocation<br />EMPLOYEE<br />#* number<br />* name<br />ojob title<br />assigned to<br />composed of<br />
  13. 13. Entity Relationship Modeling Conventions<br />Entity<br />Soft box<br />Singular, unique name<br />Uppercase<br />Synonym in parentheses<br />Attribute<br />Singular name<br />Lowercase<br />Mandatory marked with “*”<br />Optional marked with “o”<br />DEPARTMENT<br />#* number<br />* name<br />olocation<br />EMPLOYEE<br />#* number<br />* name<br />ojob title<br />assigned to<br />composed of<br />Unique Identifier (UID)<br />Primary marked with “#”<br />Secondary marked with “(#)”<br />
  14. 14. Entity Relationship Modeling Conventions<br />Entity<br />Soft box<br />Singular, unique name<br />Uppercase<br />Synonym in parentheses<br />Attribute<br />Singular name<br />Lowercase<br />Mandatory marked with “*”<br />Optional marked with “o”<br />DEPARTMENT<br />#* number<br />* name<br />olocation<br />EMPLOYEE<br />#* number<br />* name<br />ojob title<br />assigned to<br />composed of<br />Unique Identifier (UID)<br />Primary marked with “#”<br />Secondary marked with “(#)”<br />
  15. 15. 2<br />3<br />4<br />6<br />5<br />1<br />Relational Database Terminology<br /> EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO<br />------------- ------------ --------------------- -------- ---------------- ----------- -------------- -----------<br />7839KING PRESIDENT 17-NOV-81500010<br />7698BLAKEMANAGER 783901-MAY-81285030<br />7782CLARK MANAGER783909-JUN-81245010<br />7566JONES MANAGER783902-APR-81297520<br />7654MARTINSALESMAN 769828-SEP-811250140030<br />7499ALLEN SALESMAN 769820-FEB-81160030030<br />7844TURNER SALESMAN 769808-SEP-811500030<br />7900JAMES CLERK 769803-DEC-8195030<br />7521WARDSALESMAN 769822-FEB-81125050030<br />7902FORDANALYST 756603-DEC-81300020<br />7369SMITH CLERK 790217-DEC-8080020<br />7788SCOTTANALYST 756609-DEC-82300020<br />7876ADAMS CLERK 778812-JAN-83110020<br />7934MILLER CLERK 778223-JAN-82130010<br />
  16. 16. Relating Multiple Tables<br />Primary key<br />Primary key<br />Foreign key<br /><ul><li>Each row of data in a table is uniquely identified by a primary key (PK).
  17. 17. You can logically relate data from multiple tables using foreign keys (FK).</li></ul>Table Name: EMP<br />Table Name: DEPT<br />EMPNO ENAME JOB DEPTNO<br />7839 KING PRESIDENT10<br />7698 BLAKE MANAGER30<br />7782 CLARK MANAGER 10<br />7566 JONES MANAGER20<br />DEPTNO DNAME LOC<br />10 ACCOUNTING NEW YORK<br />20 RESEARCH DALLAS<br />30 SALES CHICAGO<br />40 OPERATIONS BOSTON<br />
  18. 18. Relational Database Properties<br />A relational database <br />Can be accessed and modified by executing structured query language (SQL) statements<br />Contains a collection of tables with no physical pointers<br />Uses a set of operators<br />
  19. 19. Communicating with a RDBMS Using SQL<br />SQL statementis entered<br />Statement is sent to database<br />SQL&gt; SELECT loc <br />2 FROM dept;<br />Database<br />Data is displayed<br />LOC<br />-------------<br />NEW YORK<br />DALLAS<br />CHICAGO<br />BOSTON<br />
  20. 20. Relational Database Management System<br />Server<br />User tables<br />Data <br />dictionary<br />
  21. 21. Oracle8: Object Relational Database Management System<br />User-defined data types and objects<br />Fully compatible with relational database<br />Support of multimedia and large objects<br />High-quality database server features<br />
  22. 22. Defining an Object<br />An object<br />Is a person, place, or thing<br />Knows things about itself and performs actions<br />Has an identity<br />I am a clock. I knowmy time zone, and Ican display time.<br />
  23. 23. Using an Object Model<br />Objects model a problem to solve.<br />The model is stated in terms of the interactions between objects.<br />Object models closely resemble the real world.<br />Buy<br />Sell<br />Customers<br />Business<br />
  24. 24. Characteristics of Object Systems<br />Present information in object form <br />Classify objects into object types<br />Inherit attributes and code<br />Hide data, code, and attributes<br />Interact with other objects<br />Recognize different objects without analysis <br />Interpret the same command in different ways<br />
  25. 25. Oracle Complete Solution<br />Database<br />Applications<br /> HR<br /> Financials<br /> Manufacturing<br /> ...<br />Oracle Developer<br />Discoverer <br />Oracle Designer<br />SQL* Plus<br />SQL<br />PL/SQL<br />Oracle7/8<br />Data dictionary<br />Data tables<br />
  26. 26. SQL Statements<br />SELECT <br />INSERT<br />UPDATE<br />DELETE<br />CREATE<br />ALTER<br />DROP<br />RENAME<br />TRUNCATE<br />COMMIT<br />ROLLBACK<br />SAVEPOINT<br />GRANT<br />REVOKE<br /> Data retrieval <br />Data manipulation language (DML)<br />Data definition language (DDL)<br />Transaction control<br />Data control language (DCL)<br />
  27. 27. About PL/SQL<br />PL/SQL is an extension to SQL with design features of programming languages.<br />Data manipulation and query statements of SQL are included within procedural units of code.<br />
  28. 28. PL/SQL Environment<br />PL/SQL engine<br />PL/SQL<br />Procedural<br />Statement<br />Executor<br />PL/SQL<br />block<br />PL/SQL<br />block<br />SQL<br />SQL Statement Executor<br />Oracle Server<br />
  29. 29. Tables Used in the Course<br />DEPT<br /> DEPTNO DNAME LOC<br />--------- -------------- ---------- 10 ACCOUNTING NEW YORK<br />20 RESEARCH DALLAS<br />30 SALES CHICAGO<br />40 OPERATIONS BOSTON<br />SALGRADE<br /> GRADE LOSAL HISAL<br />--------- --------- ---------<br />17001200<br />212011400<br />314012000<br />420013000<br />530019999<br />EMP<br /> EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO<br />--------- ---------- --------- --------- --------- --------- --------- ---------<br />7839 KING PRESIDENT 17-NOV-81500010<br />7698 BLAKE MANAGER 783901-MAY-81285030<br />7782 CLARK MANAGER 783909-JUN-81245010<br />7566 JONES MANAGER 783902-APR-81297520<br />7654 MARTIN SALESMAN 769828-SEP-811250140030<br />7499 ALLEN SALESMAN 769820-FEB-81160030030<br />7844 TURNER SALESMAN 769808-SEP-811500030<br />7900 JAMES CLERK 769803-DEC-8195030<br />7521 WARD SALESMAN 769822-FEB-81125050030<br />7902 FORD ANALYST 756603-DEC-81300020<br />7369 SMITH CLERK 790217-DEC-8080020<br />7788 SCOTT ANALYST 756609-DEC-82300020<br />7876 ADAMS CLERK 778812-JAN-83110020<br />7934 MILLER CLERK 778223-JAN-82130010<br />
  30. 30. Summary<br />Relational databases are composed of relations, managed by relational operations, and governed by data integrity constraints.<br />The Oracle Server allows you to store and manage information by using the SQL language and PL/SQL engine.<br />PL/SQL is an extension to SQL with design features of programming languages.<br />

×