What is a database? Logiskt sammanhängande mängd av data, med en därtill hörande betydelse, strukturerad och försedd med data avsedda för ett visst ändamål,

Slides:



Advertisements
Similar presentations
Relational Database and Data Modeling
Advertisements

Relational data objects 1 Lecture 6. Relational data objects 2 Answer to last lectures activity.
FEN Introduction to the database field: Quality checking table design: Design Guidelines Normalisation Seminar: Introduction to relational.
Chapter Information Systems Database Management.
Chapter 10: Designing Databases
SQL Introduction Standard language for querying and manipulating data Structured Query Language Many standards out there: SQL92, SQL2, SQL3. Vendors support.
CSCI3170 Introduction to Database Systems
DB Review Session. ER Diagrams 1 Where does the salary attribute belong? Actor id name address birthday Acted In Movie title type year salary.
Chapter Three Objectives Identification of Keys Application of primary and foreign keys Converting a database design to Relational DB. What is a good DBMS.
Defined by Edgar Codd in 1970 Defined by Edgar Codd in 1970 Considered ingenious but impractical Considered ingenious but impractical Conceptually simple.
RJP/RDA 1 /93 Relational Data Analysis (RDA) RDA organises all the system’s data items into a set of well NORMALISED relations. These should avoid: 1.
Normalization CMSC 461 Michael Wilson. Anomalies  Poor relational database design can lead to the occurrence of anomalies  Anomalies that we tend to.
COMP 3715 Spring 05. Working with data in a DBMS Any database system must allow user to  Define data Relations Attributes Constraints  Manipulate data.
NORMALIZATION FIRST NORMAL FORM (1NF): A relation R is in 1NF if all attributes have atomic value = one value for an attribute = no repeating groups =
Normalization Dr. Mario Guimaraes. Data Normalization Primarily a tool to validate and improve a logical design so that it satisfies certain constraints.
Normalisation The theory of Relational Database Design.
Relational Database Systems Higher Information Systems.
Normalisation Ensuring data integrity in database design 1.
The Relational Model System Development Life Cycle Normalisation
Design Guidelines Normalisation Table Design. Informal Design Guidelines Table Semantics A table should hold information about one and only one entity/concept.
Database Design Conceptual –identify important entities and relationships –determine attribute domains and candidate keys –draw the E-R diagram Logical.
Relational Data Analysis II. Plan Introduction Structured Methods –Data Flow Modelling –Data Modelling –Relational Data Analysis Feasibility Maintenance.
Chapter 4 Relational Databases Copyright © 2012 Pearson Education, Inc. publishing as Prentice Hall 4-1.
Relational Algebra. Relational Query Languages n Query = “retrieval program” n Language examples: ù Theoretical : 1. Relational Algebra 2. Relational.
Bad DB Design Duplicate of data Duplicate of data Updating Updating Deleting Deleting.
Conceptual Models. Models A model is a structure that represents certain aspects of some part of the reality.
Relational Databases What is a relational database? What would we use one for? What do they look like? How can we describe them? How can you create one?
Chapter 4 Relational Databases Copyright © 2012 Pearson Education 4-1.
Michael F. Price College of Business Chapter 6: Logical database design and the relational model.
Introduction to Schema Refinement. Different problems may arise when converting a relation into standard form They are Data redundancy Update Anomalies.
2.3 Organising Data for Effective Retrieval
Lecture 2 The Relational Model. Objectives Terminology of relational model. How tables are used to represent data. Connection between mathematical relations.
Q1: What is DBMS and explain its architecture. Q2: Explain Data Independence in detail. Q3: What is database user and explain the types of database user.
Relational Database Management Systems. A set of programs to manage one or more databases Provides means for: Accessing the data Inserting, updating and.
Database Systems Yann Thierry-Mieg. Outline 1.Introduction 2.SQL : a Simple Query Language 3.Data integrity 4.PL/SQL : Programming Language / SQL 5.Database.
Module Title? DBMS Normalization. Module Title? DBMS Normalization  Normalization is the process of removing redundant data from tables in order to improve.
Concepts of Relational Databases. Fundamental Concepts Relational data model – A data model representing data in the form of tables Relations – A 2-dimensional.
Chapter 7 1 Database Principles Data Normalization Primarily a tool to validate and improve a logical design so that it satisfies certain constraints that.
Lecture 09: Functional Dependencies. Outline Functional dependencies (3.4) Rules about FDs (3.5) Design of a Relational schema (3.6)
FEN Quality checking table design: Design Guidelines Normalisation Table Design Is this OK?
Organizing Data Revision: pages 8-10, 31 Chapter 3.
Normalization Well structured relations and anomalies Normalization First normal form (1NF) Functional dependence Partial functional dependency Second.
Chapter 12: Designing Databases
2Object-Oriented Analysis and Design with the Unified Process Objectives  Describe the differences and similarities between relational and object-oriented.
1 5 Normalization. 2 5 Database Design Give some body of data to be represented in a database, how do we decide on a suitable logical structure for that.
CS 1308 Computer Literacy and the Internet
1 Lecture 7: Normal Forms, Relational Algebra Monday, 10/15/2001.
Chapter Three ( Relational Data Model) Objectives Introduction to Relational Data Models. Advantages of Relational Data Models. Restriction of Relational.
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.
Normalization MIS335 Database Systems. Why Normalization? Optimizing database structure Removing duplications Accelerating the instructions Data integrity!
Chapter 13.3: Databases Invitation to Computer Science, Java Version, Second Edition.
Relational Algebra p BIT DBMS II.
Date: 13/03/2015 Training Reference: 2015 GIS_01 Document Reference: 2015GIS_01/PPT/L4 Issue: 2015/L4/1/V1 Addis Ababa, Ethiopia GIS Data Base Management.
Sample Table Standard Notation Entity name in uppercase
Ch 7: Normalization-Part 1
COMP 430 Intro. to Database Systems Entity-Relationship Diagram Basics Slides use ideas from Chris Ré.
Lecture 4: Logical Database Design and the Relational Model 1.
Objectives of Normalization  To create a formal framework for analyzing relation schemas based on their keys and on the functional dependencies among.
NORMALIZATION Handout - 4 DBMS. What is Normalization? The process of grouping data elements into tables in a way that simplifies retrieval, reduces data.
Logical Database Design and Relational Data Model Muhammad Nasir
2006­02-08 | Database Normalization | © MySQL AB 2006 | 1 An Introduction to Database Normalization Mike Hillyer – MySQL AB.
Normalisation Unit 6: Databases. Just to recap  What is an Entity  What is an Attribute?
Relations, Relational database Idea of relation Relational data base From the diagram ERD to database schema.
Year 12 > 13 Applied GCE ICT Unit 7 Using Database Software.
Chapter 4 Relational Databases
Chapter 2: Intro to Relational Model
Lecture 6 : Normalisation
Designing Relational Databases
Database.
Lecture 09: Functional Dependencies
Presentation transcript:

What is a database? Logiskt sammanhängande mängd av data, med en därtill hörande betydelse, strukturerad och försedd med data avsedda för ett visst ändamål, med en viss användargrupp i åtanke och återspeglande någon aspekt av världen. What is a database management system? A set of programs allowing a user to create and maintain databases. Introduction to databases

Database system Application programs / Queries Programs for query management Programs for data management MetadataDatabase User / Programmer DBMS

Why databases? Persistence Sharing Data independence

Hierarchical databases Network databases Relational databases Types of databases

A relation scheme is a set of attributes Example: PERSON(SS#, Name, Age, Salary) Every attribute has a domain Example: Name has the domain String, Age has the domain Integer A tuple for a relation scheme gives a value to each attribute in the scheme Example: (778899, John Smith, 26, 13000) The value for each attribute must be in the domain A relation is a set of tuples Relational databases

SS# Name Age Salary Eva Svensson Per Jonsson Sven Olsson Pia Eriksson PERSON Relation scheme Relation A relation can be viewed as a table without duplicates Relational databases

school pupil course teacher subject library borrower loan book school((sNr), address) pupil((eNr), firstName, surName) teacher((lNr), firstName, surName) subject((äNamn), courseBook) course((sNr, eNr, lNr, cName) library((bName), address) borrower((lNr), firstName, surName) book((ISBN), title) loan((bName, lNr, ISBN, date) Reality Subset Model Database structure From reality to database

Why design? Why not a simple table? ISBNTitleAuthorLibraryAddressBorrowerBorrowerAddDate 12345Mitt livPelleStoraStorgatan 19KalleKarlavägen Ditt livLisaStoraStorgatan 19KalleKarlavägen Vårt livPelleStoraStorgatan 19VeraVerdandig Vilket liv!LisaStoraStorgatan 19MonaMånvägen Mitt livLisaStoraStorgatan 19KalleKarlavägen StickningJohanStoraStorgatan 19KalleKarlavägen MatlagningEvaStoraStorgatan 19VeraVerdandig MatematikVeraStoraStorgatan 19MonaMånvägen Library borrower loan book library((bNamn), address) borrower((lNr), firstName, surName) book((ISBN), title) loan((bNamn, lNr, ISBN, date) Database design

An unnormalised relation scheme Name Regno Share Salary Model Per ErikssonABC Volvo Eva Olsson ABC Volvo Per ErikssonDEF Mercedes Per ErikssonGHI Toyota Pia JohnssonGHI Toyota Pia JohnssonBCD Ford Bo PerssonCDE Volvo

Problems with unnormalised schemes Redundancy Update anomalies

Functional dependencies A functional dependency means that one attribute uniquely determines another attribute. Example: Name --> Salary This functional dependency means that if two tuples have the same value on Name, then they must have the same value on Salary.

Functional dependencies Which ones of the functional dependencies are satisfied by the relation above? A --> B AB --> C CD --> B CD --> E

Keys A key in a relation scheme is an attribute (or a minimal set of attributes) that functionally determines all the other attributes in the scheme. Thus, a key uniquely identifies a tuple in a relation. What is the key in this relation scheme? MOVIE(Film, Theatre, Time, Price)

First normal form A relation scheme is in first normal form if all attribute values are atomic. SS#SurnameFirst name SvenssonGunnar, Sven OlssonKarin, Eva SS#SurnameFirst name SvenssonGunnar SvenssonSven OlssonKarin OlssonEva Not 1NF 1NF What are the keys?

Second normal form A relation scheme is in second normal form if every attribute is functionally dependent on the whloe key. Name Regno Salary Per ErikssonABC Per ErikssonDEF Pia JohnssonGHI Pia JohnssonBCD Name Regno Per ErikssonABC123 Per ErikssonDEF456 Pia JohnssonGHI789 Pia JohnssonBCD321 Name Salary Per Eriksson25000 Pia Johnsson30000

Third normal form A relation scheme is in third normal form if each attribute is functionally dependent on the key, the whole key, and nothing else than the key.

Third normal form If an attribute does not satisfy the condition for 3NF, it is removed from the relation scheme. It will form a new relation scheme together with the attributes it is functionally dependent on. Example: PERSON(SS#, Name, Country, Number_of_inhabitants) SS# --> Name, Country Country --> Number_of_inhabitants Number_of_inhabitants does not satisfy the condition for 3NF. It is removed and will form a new relation schema together with Country: PERSON(SS#, Name, Country) COUNTRY(Country, Number_of_inhabitants)

Third normal form Decompose the following relation scheme to relation schemes in 3NF. BOOK(Copy#, SS#, Date-of-loan, Return-date, Library, Library_address, Person_address, Title) A copy of a book with a title is borrowed by a person, who has an address, at a date and is returned at another date. The copy of the book resides at a library with an address.

school pupil course teacher subject library borrower loan book school((sNr), address) pupil((eNr), firstName, surName) teacher((lNr), firstName, surName) subject((äNamn), courseBook) course((sNr, eNr, lNr, cName) library((bName), address) borrower((lNr), firstName, surName) book((ISBN), title) loan((bName, lNr, ISBN, date) Reality Subset Model Database structure From reality to database

From conceptual schema to database Main steps 1. Every object type becomes a relation scheme 2. Every 1-1 and 1-m attribute of an object type becomes an attribute in the corresponding relation scheme 3. Every m-m attribute becomes a relation scheme - the attributes in this scheme are the key attributes in the associated relation schemes

From conceptual schema to database PERSONCAR StringInteger String owns (m,m,p,p) regno model agename