Databases Dr. V.T. Raja Oregon State University
Databases – Part 1: Outline Introduction Data Hierarchy Traditional file management Terminology Database DBMS Database Design Entity-Relationship Diagram
Data Hierarchy Bits Bytes (Kilo, mega, giga, tera, and peta bytes) Field (e.g., SSN, Student last name) Record File (e.g., Student file) Database
Traditional File Management Environment Each application has specific data files related to it, containing all data needed by that application. Example: University File Management Environment Application used by Registrar’s Office Application used by Financial Aid Application used by COB Application used by Athletics Department
Disadvantages associated with Traditional File Management Environment
Terminology Database: An organized collection of data that serves many applications while minimizing the disadvantages associated with the traditional file management environment DBMS: Database Management System A software that creates/maintains a database and enables storage and extraction of data/information for different business applications Example : Microsoft Access
Designing Databases Whatever DBMS you use, a database is only as good as its conceptual design. The conceptual design of a database is an abstract model of the database – from the user/business perspective. It has been a common practice to use E-R diagrams for the conceptual design of a database.
Database Design: E-R Diagram Terminologies Entity (also known as an entity class) Attributes (or Attribute Types) Key Relationships/Associations Entity Relationship Diagrams Logical view of database; Database design documentation Facilitates communication between user and database developer
Entity-Relationship Diagrams Representation: Entity: Name of each entity enclosed in a separate rectangular shape figure; Attribute type: Name of attribute type enclosed within an oval/circle shaped figure; a line is drawn to connect the attribute type to its respective parent entity. No two attribute types will have same name. Relationship: Name of relationship enclosed in a diamond shape, which is placed between two entities; 2 lines are drawn – each line connects the diamond to one of the entities. Key: represented by underlining the attribute(s) that form the key.
Examples The following info is to be stored in a database. SID, Sname, Address, Major, Phone, , Course#, CourseTitle, Instructorname, Instructor’s office, Instructor’s Address, Instructor’s phone#, course registration, grades and teaching assignment. A student can take many courses, A course could have different instructors in different terms. An instructor can teach many courses. Different types of relationships between entities are possible: 1-1; 1-M or M-1; M-M Recursive IS A relationship