Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 Lesson Overview 2.1 Basic Concept and Vocabulary 2.1 Basic Concept and Vocabulary 2.2 Database Approach: DBMS 2.2 Database Approach: DBMS 2.3 Characteristic.

Similar presentations


Presentation on theme: "1 Lesson Overview 2.1 Basic Concept and Vocabulary 2.1 Basic Concept and Vocabulary 2.2 Database Approach: DBMS 2.2 Database Approach: DBMS 2.3 Characteristic."— Presentation transcript:

1 1 Lesson Overview 2.1 Basic Concept and Vocabulary 2.1 Basic Concept and Vocabulary 2.2 Database Approach: DBMS 2.2 Database Approach: DBMS 2.3 Characteristic of DBMSs 2.3 Characteristic of DBMSs 2.4 The Relationship Between Application Programs And The DBMS 2.4 The Relationship Between Application Programs And The DBMS

2 2 2.1 Basic Concept and Vocabulary

3 3 Database Database File File Entity/ Records Entity/ Records Field/Attribute Field/Attribute Key field: Key field: Primary key Primary key Secondary key Secondary key Foreign key Foreign key Index Index Data Type Data Type Metadata Metadata Data Dictionary Data Dictionary

4 4 The Hierarchy of Data

5 5 Data Entities, Attributes, and Keys

6 6Entities/Records Entities are anything you want to store data about Entities are anything you want to store data about people (students, customers, employees, etc.) people (students, customers, employees, etc.) places (resorts, cities, countries, etc.) places (resorts, cities, countries, etc.) things (restaurants, products, invoices, movies, paintings, books, buildings, contracts, etc.) things (restaurants, products, invoices, movies, paintings, books, buildings, contracts, etc.) events (elections, presentations, earthquakes, hurricanes, etc.) events (elections, presentations, earthquakes, hurricanes, etc.)

7 7 Entity Sets Entity sets are collections of related entities. Entities are related by their classification: Entity sets are collections of related entities. Entities are related by their classification: student entities are related by the fact that they are all students student entities are related by the fact that they are all students invoice entities are related by the fact that they are all invoices invoice entities are related by the fact that they are all invoices car entities are related by the fact that they are all cars car entities are related by the fact that they are all cars

8 8 Entity Sets, cont. Entity sets are named after the entities that are stored in them. Entity sets are named after the entities that are stored in them. Entity set names are singular. Entity set names are singular. Entity set names are capitalized. Entity set names are capitalized.Examples: An entity set named STUDENT contains student entities. An entity set named INVOICE contains invoice entities. An entity set named PRODUCT contains product entities.

9 9 Entity Sets, cont. Entity sets can only contain related entities Entity sets can only contain related entities a STUDENT entity set may not contain INVOICE entities a STUDENT entity set may not contain INVOICE entities a DEPARTMENT entity set may not contain invoice entities a DEPARTMENT entity set may not contain invoice entities a PRODUCT entity set may not contain employee entities a PRODUCT entity set may not contain employee entities …. And so on

10 10 Entity Sets and Entities Entity sets are collections of related entities Unfortunately, database designers almost always use the two terms as synonyms. Unfortunately, database designers almost always use the two terms as synonyms. When database designers refer to entities, they really are referring to entity sets. When database designers refer to entities, they really are referring to entity sets. Therefore, when you see a reference to an EMPLOYEE “entity” in a database design, remember that EMPLOYEE actually represents an entity set that contains a collection of employee entities. Therefore, when you see a reference to an EMPLOYEE “entity” in a database design, remember that EMPLOYEE actually represents an entity set that contains a collection of employee entities.

11 11 Database Table Contents A database table is used to store an entity set A database table is used to store an entity set An entity set is a collection of related entities An entity set is a collection of related entities An entity is anything you want to keep track of, so an entity may be a person, place, thing, event, etc. An entity is anything you want to keep track of, so an entity may be a person, place, thing, event, etc.

12 12 Database Table Components At the conceptual level, a database table may be viewed as a matrix. At the conceptual level, a database table may be viewed as a matrix. Matrix rows are also known as tuples or records Matrix rows are also known as tuples or records each row contains an entity each row contains an entity Matrix columns are also called fields. Matrix columns are also called fields. Each column (field) contains the entity’s attribute values Each column (field) contains the entity’s attribute values

13 13 Attributes/Field Attributes are the characteristics that describe entities. Example: a student entity may be described by attributes that may include his or her... a student entity may be described by attributes that may include his or her...  social security number  name  address  date of birth  major

14 14 Attributes, cont. Remember: Attributes are the characteristics that describe entities An invoice entity may be described by attributes such as these: An invoice entity may be described by attributes such as these:  invoice number  invoice date  customer number  invoice total

15 15 Attribute Names Attribute names are capitalized. Attribute names are capitalized. For documentation reasons, attribute names are composed of two parts: For documentation reasons, attribute names are composed of two parts: the first few characters reflect the entity they help describe. the first few characters reflect the entity they help describe. subsequent characters are sufficiently descriptive to identify the attribute. subsequent characters are sufficiently descriptive to identify the attribute.

16 16 Attribute Names, cont. Examples of attribute names: EMP_LNAME = employee last name EMP_LNAME = employee last name STU_GPA = student grade point average PROD_CODE = product code CUST_LNAME = customer last name INV_NUM = invoice number

17 17 Key field Primary Key (PK): Primary Key (PK): An attribute (column), that uniquely identifies each row in a database table. An attribute (column), that uniquely identifies each row in a database table. Cannot contains NULL values Cannot contains NULL values Secondary Key: Secondary Key: A non-PK search key, which may not yield unique records. E.g.: the combination of first and last name may be a secondary key. A non-PK search key, which may not yield unique records. E.g.: the combination of first and last name may be a secondary key. Foreign Key (FK) Foreign Key (FK) An attribute (column) in a table that is a PK in another table. E.g.: in Order table, Customer_ID is a FK because it is a PK in the Customer table. An attribute (column) in a table that is a PK in another table. E.g.: in Order table, Customer_ID is a FK because it is a PK in the Customer table.

18 18 Entity Integrity A table exhibits entity integrity when all of its Primary Key (PK) values uniquely identify each table row (record.) EMPLOYEE table 1. A PK cannot contain duplicate values 2. A PK cannot contains nulls Note: A null indicates the absence of a value; it is not a blank. (You create a null when you tap the ENTER key without first making an entry. A blank is created when you tap the space bar and then tap the ENTER key.)

19 19 Foreign keys (FK) and Referential Integrity To maintain referential integrity, a foreign key (FK) must reference an existing PK value in a related table or it may be null. A Foreign Key (FK) is an attribute located in one table that “points to” a Primary Key (PK) in a related table. The use of FKs allows you relate one table to another. INVOICE table LINE table

20 20 Index A secondary file structure that provides an alternative path to the data. A secondary file structure that provides an alternative path to the data. A sorted list of key values from the original table along with a pointer to the rest of the data in each row. A sorted list of key values from the original table along with a pointer to the rest of the data in each row. Used to speed up searches and data retrieval. Used to speed up searches and data retrieval.

21 21 Data Type The data characteristic that determines how the filed values can be used. The data characteristic that determines how the filed values can be used. Example: Example: An employee name is properly defined to be a text data type. An employee name is properly defined to be a text data type. An employee birthday is defined as date data type An employee birthday is defined as date data type E.g.: text, numeric, date, currency, OLE object E.g.: text, numeric, date, currency, OLE object

22 22 Metadata Data about data Data about data Data that describe other data including the source, use, value and meaning of the data Data that describe other data including the source, use, value and meaning of the data Typically stored in a data dictionary Typically stored in a data dictionary E.g.: E.g.:

23 23 Data Dictionary A compilation of the metadata A compilation of the metadata A special database that describe individual databases and its environment. A special database that describe individual databases and its environment. Contains data descriptors called metadata that define source, the use, the value and the meaning of data. Contains data descriptors called metadata that define source, the use, the value and the meaning of data.

24 24 2.1Database Approach: DBMS

25 25 Fig 5.3

26 26 Problems with the “Traditional” Approach Example: Example: Students registration Students registration Students library Students library Students Industrial training Students Industrial training Students graduation Students graduation Data redundancy Data redundancy Program-data dependence Program-data dependence Inflexibility Inflexibility

27 27 Database Approach

28 28 Table 5.1

29 29 Table 5.2

30 30 Database Management Systems (DBMSs) Provide a user view Provide a user view Provide tools to create & modify the database Provide tools to create & modify the database Store & retrieve data Store & retrieve data Manipulate data Manipulate data Produce reports Produce reports

31 31 Fig 5.15

32 32 Fig 5.16

33 33 Fig 5.17

34 34 Database Management System (DBMS) “The Tools” Define – specify data types, structures and constraints Define – specify data types, structures and constraints Construct – initial creation and population Construct – initial creation and population Manipulate – run queries, Alter table definitions, insert/delete records Manipulate – run queries, Alter table definitions, insert/delete records Share – Concurrent access, Share – Concurrent access, Protect – from system malfunction or malicious attacks Protect – from system malfunction or malicious attacks Maintain – As requirements change, so should the system. Maintain – As requirements change, so should the system.

35 35 What DBMS have you heard of? __________________________ ___ __________________________ ___

36 36 Mainstream DBMSs Oracle - Oracle corporation Oracle - Oracle corporation www.oracle.com www.oracle.com www.oracle.com DB2 - IBM DB2 - IBM http://www-306.ibm.com/software/data/db2/udb/ http://www-306.ibm.com/software/data/db2/udb/ http://www-306.ibm.com/software/data/db2/udb/ ACCESS, SQL Server - Microsoft ACCESS, SQL Server - Microsoft http://www.microsoft.com/Office/Access/prodinfo/ http://www.microsoft.com/Office/Access/prodinfo/ http://www.microsoft.com/Office/Access/prodinfo/ Adaptive Server Enterprise (ASE) - Sybase Adaptive Server Enterprise (ASE) - Sybase http://www.sybase.com/products/databaseservers/ase http://www.sybase.com/products/databaseservers/ase http://www.sybase.com/products/databaseservers/ase MySQL - MySQL Open source MySQL - MySQL Open source http://www.mysql.com/ http://www.mysql.com/ http://www.mysql.com/ PostgreSQL – Global Development Group PostgreSQL – Global Development Group http://advocacy.postgresql.org/ http://advocacy.postgresql.org/ http://advocacy.postgresql.org/

37 37 Oracle Ideal for large scale grid and cluster computing Ideal for large scale grid and cluster computing Currently pushing toward small business, single computer servers Currently pushing toward small business, single computer servers Many Enterprise applications are available or included Many Enterprise applications are available or included Finance management Finance management Human Resource Management Human Resource Management Marketing Marketing Product lifecycle management Product lifecycle management On and on and on... On and on and on... 43% market share 43% market share

38 38 DB2 Flexible to install on a wide variety of systems Flexible to install on a wide variety of systems Focuses on the integration of other DBMS. Focuses on the integration of other DBMS. Data can be distributed. Data can be distributed. Has many application packages, similar to Oracle Has many application packages, similar to Oracle 24% Market Share 24% Market Share

39 39 SQL Server Targets small business Targets small business Easy to install Easy to install Low cost of ownership Low cost of ownership Excellent Support Excellent Support Notoriously insecure Notoriously insecure Susceptible to virus and worm attacks Susceptible to virus and worm attacks New patches released monthly New patches released monthly 17% Market Share 17% Market Share

40 40 Adaptive Server Enterprise (ASE) - Sybase Low resource requirements Low resource requirements Fast and reliable Fast and reliable Lower cost of ownership compared to Oracle or DB2 Lower cost of ownership compared to Oracle or DB2 Popular on Wall Street due to its high transaction rate Popular on Wall Street due to its high transaction rate 2% Market Share 2% Market Share

41 41 MySQL Open source DBMS Open source DBMS Supported by a for-profit company Supported by a for-profit company Well known compared to other open source solutions. Well known compared to other open source solutions. Offers free GPL version and a licensed version that includes vendor support. Offers free GPL version and a licensed version that includes vendor support. Less popular and less scalable than Oracle, DB2 or ASE Less popular and less scalable than Oracle, DB2 or ASE

42 42 PostgreSQL Open Source DBMS Open Source DBMS Developed (originally) at the University of California, Berkeley Developed (originally) at the University of California, Berkeley Supported by a non-for-profit organization: PostgreSQL – Global Development Group Supported by a non-for-profit organization: PostgreSQL – Global Development Group More developed and robust than MySQL More developed and robust than MySQL Less popular in the business world Less popular in the business world

43 43 DBMS vs. Custom application Database Definition (meta-data) Stored Data Software to Process Queries Software to Access Stored Data User Interface User Interface/ Software to Process Queries/ Software to Access Stored Data Stored Data Users Database approach Custom App. DBMS software

44 44 2.3 Characteristic of DBMSs

45 45 Characteristics of the Database Approach 1. Self Describing  A catalog keeps track of the database structure  Contains a description of its own structure called a data dictionary, data directory, metadata

46 46 Self Describing 1.Catalog allows freedom to choose DBMS Database Definition (meta-data) Stored Data Software to Process Queries Software to Access Stored Data User Interface Software to Process Queries Software to Access Stored Data choice 1 choice 2... Software to Process Queries Software to Access Stored Data choice n

47 47 Self Describing 1.One DBMS can access several independent databases Meta-Data 1 Stored Data 1 User Interface Software to Process Queries Software to Access Stored Data Meta-Data 2 Stored Data 2 University DBMatchmaker DB

48 48 Characteristics of the Database Approach 1. Self Describing  A catalog keeps track of the database structure 2. Program/Data Independence  Allows program to be modified without changing the file structure.

49 49 Program/Data Independence DBMSCustom App. User Interface Catalog NameAgeGender NameAgeGender Client:

50 50 Program/Data Independence DBMSCustom App. User Interface Catalog NameAgeGender NameAgeGender Height Client: Is the existence of a catalog sufficient for program data independence?

51 51 Characteristics of the Database Approach 1. Self Describing  A catalog keeps track of the database structure 2. Program/Data Independence 3. Multiple Views  View=Virtual Table

52 52 Views Internal (Physical) Tables Conceptual tables... View 1View 2View 3View n User Interface, variety of users

53 53 When would multiple views be useful? __________________________ ___ __________________________ ___

54 54 Example Views – Matchmaker DB DBA view (logical table) Owning client’s view (virtual table) View to brows other client’s info. (virtual table)

55 55 Characteristics of the Database Approach 1. Self Describing  A catalog keeps track of the database structure 2. Program/Data Independence 3. Multiple Views  View=Virtual Table 4. Data Integration - Pooling the files in a centralized location Data Sharing - Allows all authorized users access through data integration Data Sharing - Allows all authorized users access through data integration Minimum Data Duplication Or Redundancy - Maintaining System integrity, efficiency and reliability Minimum Data Duplication Or Redundancy - Maintaining System integrity, efficiency and reliability

56 56 2.4 The Relationship Between Application Programs And The DBMS

57 57 The Relationship Between Application Programs And The DBMS A User Interacts with a Application with Database A User Interacts with a Application with Database The Application Interfaces with the DBMS The Application Interfaces with the DBMS The DBMS accesses the Database The DBMS accesses the Database

58 58 Actors/Users Developers Developers DBA DBA Designer Designer System Analyst System Analyst Programmer Programmer End user End user Parametric Parametric Casual Casual Sophisticated Sophisticated

59 59 The Relationship Between Application Programs And The DBMS -Continue... At one time application programs and the DBMS were clearly distinct At one time application programs and the DBMS were clearly distinct Application Programs were written In 3GL such as COBOL in the past. Application Programs were written In 3GL such as COBOL in the past. Currently all 4 th GL or web-based development tools can associate with DBMS. Currently all 4 th GL or web-based development tools can associate with DBMS. These Application Programs called upon the DBMS for management services. These Application Programs called upon the DBMS for management services.

60 60 USER Database Applications DBMS Database The Relationship Between Application Programs And The DBMS -Continue...

61 61 Summary Basic Concept and Vocabulary Basic Concept and Vocabulary Database Database File File Entity/ Records Entity/ Records Field/Attribute Field/Attribute Key field: Key field: Primary key Primary key Secondary key Secondary key Foreign key Foreign key Index Index Data Type Data Type Metadata Metadata Data Dictionary Data Dictionary

62 62 Summary Characteristic of DBMSs Characteristic of DBMSs 1. Self Describing 2. Program/Data Independence 3. Multiple Views 4. Data Integration The Relationship Between Application Programs And The DBMS The Relationship Between Application Programs And The DBMS


Download ppt "1 Lesson Overview 2.1 Basic Concept and Vocabulary 2.1 Basic Concept and Vocabulary 2.2 Database Approach: DBMS 2.2 Database Approach: DBMS 2.3 Characteristic."

Similar presentations


Ads by Google