Presentation is loading. Please wait.

Presentation is loading. Please wait.

o At the end of this lesson, you will be able to:  Describe the life-cycle development phases  Discuss the theoretical and physical aspects of a relational.

Similar presentations


Presentation on theme: "o At the end of this lesson, you will be able to:  Describe the life-cycle development phases  Discuss the theoretical and physical aspects of a relational."— Presentation transcript:

1

2 o At the end of this lesson, you will be able to:  Describe the life-cycle development phases  Discuss the theoretical and physical aspects of a relational database  Describe the MySQL implementation of the RDBMS

3 StrategyandAnalysis Design BuildandDocument Transition Production

4 Electronic spreadsheet Filing cabinet Database SALGRADE SALGRADE GRADE LOSAL HISAL --------- --------- --------- 1 700 1200 2 1201 1400 3 1401 2000 4 2001 3000 5 3001 9999 SALGRADE SALGRADE GRADE LOSAL HISAL --------- --------- --------- 1 700 1200 2 1201 1400 3 1401 2000 4 2001 3000 5 3001 9999 DEPT DEPTNO DNAME LOC --------- -------------- ---------- 10 ACCOUNTING NEW YORK 20 RESEARCH DALLAS 30 SALES CHICAGO 40 OPERATIONS BOSTON DEPT DEPTNO DNAME LOC --------- -------------- ---------- 10 ACCOUNTING NEW YORK 20 RESEARCH DALLAS 30 SALES CHICAGO 40 OPERATIONS BOSTON

5 o Dr. E. F. Codd proposed the relational model for database systems in 1970. o It is the basis for the relational database management system (RDBMS). o The relational model consists of the following:  Collection of objects or relations  Set of operators to act on the relations  Data integrity for accuracy and consistency

6 Model of system in client’s mind Entity model of client’s model Table model of entity model Tables on disk Server

7 EMPLOYEE #* number *name ojob title EMPLOYEE #* number *name ojob title DEPARTMENT #* number *name olocation DEPARTMENT #* number *name olocation assigned to composed of Create an entity relationship diagram from business specifications or narratives Scenario – “... Assign one or more employees to a department...” – “... Some departments do not yet have assigned employees...”

8 Entity Soft box Singular, unique name Uppercase Synonym in parentheses Attribute Singular name Lowercase Mandatory marked with “*” Optional marked with “o” Unique Identifier (UID) Primary marked with “#” Secondary marked with “(#)” EMPLOYEE #* number *name ojob title EMPLOYEE #* number *name ojob title DEPARTMENT #* number *name olocation DEPARTMENT #* number *name olocation assigned to composed of

9 o A relational database  Can be accessed and modified by executing structured query language (SQL) statements  Contains a collection of tables with no physical pointers  Uses a set of operators

10 o A relational database is a collection of relations or two-dimensional tables. Database DEPTNO DNAME LOC 10 ACCOUNTING NEW YORK 20 RESEARCH DALLAS 30 SALES CHICAGO 40 OPERATIONS BOSTON DEPTNO DNAME LOC 10 ACCOUNTING NEW YORK 20 RESEARCH DALLAS 30 SALES CHICAGO 40 OPERATIONS BOSTON Table Name: DEPT EMPNO ENAME JOB DEPTNO 7839 KING PRESIDENT 10 7698 BLAKE MANAGER 30 7782 CLARK MANAGER 10 7566 JONES MANAGER 20 EMPNO ENAME JOB DEPTNO 7839 KING PRESIDENT 10 7698 BLAKE MANAGER 30 7782 CLARK MANAGER 10 7566 JONES MANAGER 20 Table Name: EMP

11 1 2 3 4 5 EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO ------------- --------------------------------- -------- ---------------- ----------- -------------- ----------- 7839 KING PRESIDENT 17-NOV-815000 10 7698 BLAKEMANAGER 7839 01-MAY-81 2850 30 7782 CLARK MANAGER7839 09-JUN-81 2450 10 7566 JONES MANAGER7839 02-APR-81 2975 20 7654 MARTINSALESMAN 7698 28-SEP-81 1250 1400 30 7499 ALLEN SALESMAN 7698 20-FEB-81 1600 300 30 7844 TURNER SALESMAN 7698 08-SEP-81 1500 0 30 7900 JAMES CLERK 7698 03-DEC-81 950 30 7521 WARDSALESMAN 7698 22-FEB-81 1250 500 30 7902 FORDANALYST 7566 03-DEC-81 3000 20 7369 SMITH CLERK 7902 17-DEC-80 800 20 7788 SCOTTANALYST 7566 09-DEC-82 3000 20 7876 ADAMS CLERK 7788 12-JAN-83 1100 20 7934 MILLER CLERK 7782 23-JAN-82 1300 10 6

12 Each row of data in a table is uniquely identified by a primary key (PK). Table Name: EMP Table Name: DEPT Primary key You can logically relate data from multiple tables using foreign keys (FK). Foreign key EMPNO ENAME JOB DEPTNO 7839 KING PRESIDENT 10 7698 BLAKE MANAGER 30 7782 CLARK MANAGER 10 7566 JONES MANAGER 20 DEPTNO DNAME LOC 10 ACCOUNTING NEW YORK 20 RESEARCH DALLAS 30 SALES CHICAGO 40 OPERATIONS BOSTON

13 SELECT Data retrieval INSERT UPDATE Data manipulation language (DML) DELETE CREATE ALTER Data definition language (DDL) DROP Data definition language (DDL) RENAME TRUNCATE COMMIT Transaction control ROLLBACK Transaction control SAVEPOINT GRANT Data control language (DCL) REVOKE Data control language (DCL)

14 User tables Datadictionary Server

15 Database SQL> SELECT loc 2 FROM dept; SQL> SELECT loc 2 FROM dept; SQL statement is entered Statement is sent to database LOC ------------- NEW YORK DALLAS CHICAGO BOSTON LOC ------------- NEW YORK DALLAS CHICAGO BOSTON Data is displayed

16 EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO --------- ---------- --------- --------- --------- --------- --------- --------- 7839 KING PRESIDENT 17-NOV-81 5000 10 7698 BLAKE MANAGER 7839 01-MAY-81 2850 30 7782 CLARK MANAGER 7839 09-JUN-81 1500 10 7566 JONES MANAGER 7839 02-APR-81 2975 20 7654 MARTIN SALESMAN 7698 28-SEP-81 1250 1400 30 7499 ALLEN SALESMAN 7698 20-FEB-81 1600 300 30 7844 TURNER SALESMAN 7698 08-SEP-81 1500 0 30 7900 JAMES CLERK 7698 03-DEC-81 950 30 7521 WARD SALESMAN 7698 22-FEB-81 1250 500 30 7902 FORD ANALYST 7566 03-DEC-81 3000 20 7369 SMITH CLERK 7902 17-DEC-80 800 20 7788 SCOTT ANALYST 7566 09-DEC-82 3000 20 7876 ADAMS CLERK 7788 12-JAN-83 1100 20 7934 MILLER CLERK 7782 23-JAN-82 1300 10AA EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO --------- ---------- --------- --------- --------- --------- --------- --------- 7839 KING PRESIDENT 17-NOV-81 5000 10 7698 BLAKE MANAGER 7839 01-MAY-81 2850 30 7782 CLARK MANAGER 7839 09-JUN-81 1500 10 7566 JONES MANAGER 7839 02-APR-81 2975 20 7654 MARTIN SALESMAN 7698 28-SEP-81 1250 1400 30 7499 ALLEN SALESMAN 7698 20-FEB-81 1600 300 30 7844 TURNER SALESMAN 7698 08-SEP-81 1500 0 30 7900 JAMES CLERK 7698 03-DEC-81 950 30 7521 WARD SALESMAN 7698 22-FEB-81 1250 500 30 7902 FORD ANALYST 7566 03-DEC-81 3000 20 7369 SMITH CLERK 7902 17-DEC-80 800 20 7788 SCOTT ANALYST 7566 09-DEC-82 3000 20 7876 ADAMS CLERK 7788 12-JAN-83 1100 20 7934 MILLER CLERK 7782 23-JAN-82 1300 10AA EMPLOYEEDEPARTMENT DEPTNO DNAME LOC --------- -------------- ---------- 10 ACCOUNTING NEW YORK 20 RESEARCH DALLAS 30 SALES CHICAGO 40 OPERATIONS BOSTON DEPTNO DNAME LOC --------- -------------- ---------- 10 ACCOUNTING NEW YORK 20 RESEARCH DALLAS 30 SALES CHICAGO 40 OPERATIONS BOSTON GRADE LOSAL HISAL --------- --------- --------- 1 700 1200 2 1201 1400 3 1401 2000 4 2001 3000 5 3001 9999 GRADE LOSAL HISAL --------- --------- --------- 1 700 1200 2 1201 1400 3 1401 2000 4 2001 3000 5 3001 9999SALARY_GRADE

17 o Relational databases are:  Composed of relations  Managed by relational operations  Governed by data integrity constraints o MySQL is based on the relational database management system. o MySQL allows you to store and manage information by using the SQL language.


Download ppt "o At the end of this lesson, you will be able to:  Describe the life-cycle development phases  Discuss the theoretical and physical aspects of a relational."

Similar presentations


Ads by Google