Jyh-haw Yeh Dept. of Computer Science Boise State University

Slides:



Advertisements
Similar presentations
ER Modeling Case Studies
Advertisements

Database System - Assignment #3 Sept. 2012Yangjun Chen ACS Assignment #3 due Wed., Nov. 14, (30) Exercise 7.17 on Page 235 Show the result.
Defined by Edgar Codd in 1970 Defined by Edgar Codd in 1970 Considered ingenious but impractical Considered ingenious but impractical Conceptually simple.
Data Definition Languages Atif Farid Mohammad UNCC.
Overview Begin 6:00 Quiz15 mins6:15 Review Table Terms25 mins6:40 Short Break10 mins6:50 SQL: Creating Tables60 mins7:50 Break10 mins8:00 Lab – Creating.
Exploring Microsoft Access 2003 Chapter 4 Proficiency: Relational Databases, External Data, Charts, Pivot, and the Switchboard.
Mapping an ERD to a Relational Database To map an ERD to a relational database, five rules are defined to govern how tables are constructed. 1)Rule for.
Review Database Application Development Access Database Development ER-diagram Forms Reports Queries.
1 Functional Dependency and Normalization Informal design guidelines for relation schemas. Functional dependencies. Normal forms. Normalization.
Chapter 4 Relational Databases Copyright © 2012 Pearson Education, Inc. publishing as Prentice Hall 4-1.
Data modeling using the entity-relationship model Winter 2006Ron McFadyen Entity-relationship model (ER model) P. 49: “This model and its variations.
Class Number – CS 304 Class Name - DBMS Instructor – Sanjay Madria Instructor – Sanjay Madria Lesson Title – ER Model.
Chapter 4 Relational Databases Copyright © 2012 Pearson Education 4-1.
Database Management Systems (DBMS)
Data Modeling Using the Entity-Relationship Model
Information storage: Introduction of database 10/7/2004 Xiangming Mu.
Functional Dependencies
DATABASE MANAGEMENT SYSTEMS BASIC CONCEPTS 1. What is a database? A database is a collection of data which can be used: alone, or alone, or combined /
DATABASE MANAGEMENT SYSTEMS BASIC CONCEPTS 1. What is a database? A database is a collection of data which can be used: alone, or alone, or combined /
Database. Basic Definitions Database: A collection of related data. Database Management System (DBMS): A software package/ system to facilitate the creation.
Riyadh Philanthropic Society For Science Prince Sultan College For Woman Dept. of Computer & Information Sciences CS 340 Introduction to Database Systems.
Database Technical Session By: Prof. Adarsh Patel.
Review: Application of Database Systems
Introduction to Database Systems
SQL Structured Query Language Programming Course.
Lecture2: Database Environment Prepared by L. Nouf Almujally & Aisha AlArfaj 1 Ref. Chapter2 College of Computer and Information Sciences - Information.
1 Chapter 1 Introduction. 2 Introduction n Definition A database management system (DBMS) is a general-purpose software system that facilitates the process.
How to build ER diagrams
Lecture2: Database Environment Prepared by L. Nouf Almujally 1 Ref. Chapter2 Lecture2.
1 JOIN SUBQUERY Structured Query Language (SQL) - Part III.
CS 405G: Introduction to Database Systems Lecture 2 : Database Design I.
Oracle & SQL Introduction. Database Concepts Revision DB? DBMS? DB Application? Application Programs? DBS? Examples of DBS? Examples of DBMS? 2Oracle.
Database Management COP4540, SCS, FIU Database Modeling Using the Entity-Relationship Model (Continued)
Riyadh Philanthropic Society For Science Prince Sultan College For Woman Dept. of Computer & Information Sciences CS 340 Introduction to Database Systems.
Logical Design database design. Dr. Mohamed Osman Hegaz2 Conceptual Database Designing –Provides concepts that are close to the way many users perceive.
Entity-Relationship Model Chapter 3 II COSC 457 Sungchul Hong.
INTRODUCTION lecture1 1. Data base concept Data is a meaningless static value. What does 3421 means? Information is the data you process in a manner that.
Chapter-1- Basic Concepts Reference: Prof. Mona Mursi Lecture notes
Al-Imam University Girls Education Center Collage of Computer Science 1 st Semester, 1432/1433H Chapter 10_part 1 Functional Dependencies and Normalization.
Constraints and Views Chap. 3-5 continued (7 th ed. 5-7)
1 Database Design Chapter-2- Database System Concepts and Architecture Reference: Prof. Mona Mursi Lecture notes.
Example COMPANY Database
1 The Relational Data Model David J. Stucki. Relational Model Concepts 2 Fundamental concept: the relation  The Relational Model represents an entire.
Chapter 15 1 Functional Dependencies and Normalization for Relational Databases تنبيه : شرائح العرض (Slides) هي وسيلة لتوضيح الدرس واداة من الادوات في.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 7 Lecture # 16 July 26,2012 Data Modeling using the Entity Relationship.
Fundamental of Database Systems
Data Modeling Using the Entity- Relationship (ER) Model
Databases (CS507) CHAPTER 7.
CS4222 Principles of Database System
CS580 Advanced Database Topics
Relational Database Design by ER- and EERR-to-Relational Mapping
بسم الله الرحمن الرحيم.
Introduction lecture1.
From ER to Relational Model
Company Requirements.
CS4222 Principles of Database System
Entity-Relationship Modeling "Extended"
Conceptual Data Modeling Using Entities & Relationships
Structured Query Language (3)
Relational Database Design by ER- and EER-to- Relational Mapping
1. Explain the following concepts: (a) superkey (b) key
1.(5) Describe the working process with a database system.
Mapping an ERD to a Relational Database
SQL Updating Database Contents Presented by: Dr. Samir Tartir
SQLPLUS: Oracle SQL Interface
1. Explain the following concepts of the ER data model:
Entity Relation Model Tingting Zhang.
CS4222 Principles of Database System
Entity-Relationship Modeling "Extended"
Entity-Relationship Modeling "Extended"
Presentation transcript:

Jyh-haw Yeh Dept. of Computer Science Boise State University DATABASES Jyh-haw Yeh Dept. of Computer Science Boise State University

What is a database? A collection of related data, stored in a structured way. It represents some aspects of real world. Databases are created and maintained by a DBMS (DataBase Management System). Well known DBMS: Oracle, Informix, MySQL…

DataBase Management Systems DBMS facilitates the processes of defining, constructing, and manipulating databases. Defining a database: specify data type, structures and constraints for the data. Constructing a database: store data on some storage medium. Manipulating a database: querying and updating.

Database Design Process Talk to clients to get the application’s requirements and constraints. Design the database using high level conceptual data model, such as ER and EER. Use a mapping algorithm to convert ER or EER to relational data model.

Database Design Process (cont.) Use the normal forms and functional dependencies to fine tune the design. Use some DBMS to create and maintain the database.

Designing a Company Database Client’s requirements and constraints: The company is organized into DEPARTMENTS, each department has a unique Name, a unique Number, and a particular EMPLOYEE as a MANAGER. We keep track of the Start Date of the MANAGER. A department may have several Locations. A department CONTROLS some PROJECTS. A PROJECT has a unique Name, a unique Number, and a single Location. We store each employee's Name, Ssn, Address, Salary, Sex, and Birth Date. An employee is ASSIGNED to one department but may WORK ON several projects, which are not necessarily CONTROLLED by the same department. We store the number of Hours per week that an employee works on each project. Each employee has a direct SUPERVISOR. We want to keep track of the DEPENDENTS of each employee for insurance purposes. We keep each dependent's First Name, Sex, Birth Date, and Relationship to the employee.

Designing a Company Database Design the database by ER Model Entity type: a type of real world entities. Relationship type: relation between entities. Attribute: describes the properties of entities. Next page shows a possible design of the company database in the ER model.

Designing a Company Database Map ER model to relational model: A mapping algorithm exists for the mapping. A relational database is a set of tables (or relations). The table heading is a list of attributes. Next page shows the result after mapping of the company database in a relational model.

Designing a Company Database Using functional dependency and normal forms to fine-tune the database design. The objectives of this step: Clear semantics to attributes. Reduce the NULL values. Reduce data redundancy. Avoid generate spurious tuples. Examples: Figures 14.4, 14.5, 14.6 http://cs.boisestate.edu/~jhyeh/teach/cs410_bookfigures_ch14.pdf

Implement the Company Database in a DBMS Using SQL-DDL to create database: The DDL for the company example is shown in http://cs.boisestate.edu/~jhyeh/teach/cs410_bookfigures_ch08.pdf The company database will be created if a DBMS executes the above DDL. Next, using the load utility, provided by the DBMS, to load data into the database. http://cs.boisestate.edu/~jhyeh/teach/cs410_bookfigures_ch07.pdf

Manipulating the Company Database Use SQL-DML to update or retrieve information from the database. Update, for example: Insert a new employee, Delete a department, Update someone’s salary…. Retrieve, for example: Retrieve the names of employees who work on multiple projects……

SQL-DML Examples insert into EMPLOYEE values (‘Richard’, ‘K’, ‘Jones’, ‘987654321’, ‘1972-08-25’, ‘101 University Dr., Boise, ID’, ‘M’, 55000, ‘888665555’, 1); delete from DEPARTMENT where DNAME = ‘Research’; update EMPLOYEE set SALARY = SALARY * 1.1 where DNO = 5;

SQL-DML Example FNAME LNAME John Smith Joyce English Franklin Wong Query: retrieve the names of employees who work on multiple projects. select FNAME, LNAME from EMPLOYEE, WORKS_ON where SSN = ESSN and group by SSN having count(*) > 1; FNAME LNAME John Smith Joyce English Franklin Wong Alicia Zelaya Ahmad Jabbar

SQL-DML Example select FNAME, LNAME FNAME LNAME John Smith Franklin Query: retrieve the names of employees in Research department. select FNAME, LNAME from EMPLOYEE, DEPARTMENT where DNO = DNUMBER and DNAME = ‘Research’; FNAME LNAME John Smith Franklin Wong Ramesh Narayan Joyce English