CSS/416 Data Design and Retrieval Workshop 3. CSS/416 Workshop 32 Database Management Systems Terminology Traditional MIS RDBMS Relational Algebra FileTableRelation.

Slides:



Advertisements
Similar presentations
5 5 Normalization of Database Tables Database Systems: Design, Implementation, and Management 4th Edition Peter Rob & Carlos Coronel.
Advertisements

Chapter 5 Normalization of Database Tables
The Relational Model and Relational Algebra Nothing is so practical as a good theory Kurt Lewin, 1945.
Relational Database. Relational database: a set of relations Relation: made up of 2 parts: − Schema : specifies the name of relations, plus name and type.
SQL Lecture 10 Inst: Haya Sammaneh. Example Instance of Students Relation  Cardinality = 3, degree = 5, all rows distinct.
Accounting System Design
1 Logical Database Design and the Relational Model Modern Database Management.
Normalization of Database Tables Special adaptation for INFS-3200
Systems Development Life Cycle
Fundamentals, Design, and Implementation, 9/e Chapter 4 The Relational Model and Normalization.
© 2005 by Prentice Hall 1 Chapter 5: Logical Database Design and the Relational Model Modern Database Management 7 th Edition Jeffrey A. Hoffer, Mary B.
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall 3-1 COS 346 Day 5.
© 2002 by Prentice Hall 1 David M. Kroenke Database Processing Eighth Edition Chapter 10 Database Application Design.
Database Design Conceptual –identify important entities and relationships –determine attribute domains and candidate keys –draw the E-R diagram Logical.
3-1 Chapter 3 Data and Knowledge Management
1 © Prentice Hall, 2002 Chapter 5: Logical Database Design and the Relational Model Modern Database Management 6 th Edition Jeffrey A. Hoffer, Mary B.
Chapter 5 Normalization of Database Tables
Chapter 4 Relational Databases Copyright © 2012 Pearson Education, Inc. publishing as Prentice Hall 4-1.
Terms - data,information, file record, table, row, column, transaction, concurrency Concepts - data integrity, data redundancy, Type of databases – single-user,
Data at the Core of the Enterprise. Objectives  Define of database systems  Introduce data modeling and SQL  Discuss emerging requirements of database.
Michael F. Price College of Business Chapter 6: Logical database design and the relational model.
Chapter 3 The Relational Model and Normalization
Chapter 5 Normalization of Database Tables
Chapter 4: Logical Database Design and the Relational Model (Part II)
Data at the Core of the Enterprise. Objectives  Define of database systems.  Introduce data modeling and SQL.  Discuss emerging requirements of database.
Primary & Foreign Keys. PK & FK 1.Primary key is required 2.The PK must be unique 3.If the primary key from one table is related to a field in another.
MIS 385/MBA 664 Systems Implementation with DBMS/ Database Management Dave Salisbury ( )
Concepts and Terminology Introduction to Database.
MIS 301 Information Systems in Organizations Dave Salisbury ( )
Chapter 5 The Relational Model and Normalization David M. Kroenke Database Processing © 2000 Prentice Hall.
Chapter 5: Logical Database Design and the Relational Model
Fundamentals, Design, and Implementation, 9/e. Database Processing: Fundamentals, Design and Implementation, 9/e by David M. KroenkeChapter 4/2 Copyright.
CMPE 226 Database Systems September 16 Class Meeting Department of Computer Engineering San Jose State University Fall 2015 Instructor: Ron Mak
Component 4: Introduction to Information and Computer Science Unit 6: Databases and SQL Lecture 4 This material was developed by Oregon Health & Science.
Database Systems: Design, Implementation, and Management Tenth Edition
Database Systems: Design, Implementation, and Management Ninth Edition Chapter 6 Normalization of Database Tables.
The Relational Model and Normalization R. Nakatsu.
Normalization (Codd, 1972) Practical Information For Real World Database Design.
Concepts of Relational Databases. Fundamental Concepts Relational data model – A data model representing data in the form of tables Relations – A 2-dimensional.
BIS Database Systems School of Management, Business Information Systems, Assumption University A.Thanop Somprasong Chapter # 5 Normalization of Database.
SALINI SUDESH. Primarily a tool to validate and improve a logical design so that it satisfies certain constraints that avoid unnecessary duplication of.
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition © 2006 Pearson Prentice Hall, Modified by Dr. Mathis 3-1 David M. Kroenke’s Chapter Three: The Relational.
DataBase Management System What is DBMS Purpose of DBMS Data Abstraction Data Definition Language Data Manipulation Language Data Models Data Keys Relationships.
Feb 2001CSS/416:Module U1 Workshop 11 CSS/416 Data Design And Information Retrieval Workshop 1.
Database Application Design and Data Integrity AIMS 3710 R. Nakatsu.
© 2009 Pearson Education, Inc. Publishing as Prentice Hall 1 Chapter 7 (Part a): Introduction to SQL Modern Database Management 9 th Edition Jeffrey A.
1 © Prentice Hall, 2002 Chapter 5: Logical Database Design and the Relational Model Modern Database Management 6 th Edition Jeffrey A. Hoffer, Mary B.
Chapter 10 Database Application Design David M. Kroenke Database Processing © 2000 Prentice Hall.
Database Processing: Fundamentals, Design and Implementation, 9/e by David M. KroenkeChapter 4/1 Copyright © 2004 Please……. No Food Or Drink in the class.
Logical Database Design and the Relational Model.
1 ER Modeling BUAD/American University Mapping ER modeling to Relationships.
1 © Prentice Hall, 2002 ITD1312 Database Principles Chapter 4B: Logical Design for Relational Systems -- Transforming ER Diagrams into Relations Modern.
Logical Database Design and the Relational Model.
© 2009 Pearson Education, Inc. Publishing as Prentice Hall 1 Chapter 5 (Part a): Logical Database Design and the Relational Model Modern Database Management.
Chapter 3: Relational Databases
1 CS 430 Database Theory Winter 2005 Lecture 7: Designing a Database Logical Level.
Lecture 4: Logical Database Design and the Relational Model 1.
Databases Introduction - concepts. Concepts of Relational Databases.
Logical Database Design and Relational Data Model Muhammad Nasir
CH 10 DB Application Design n 10.1 Functions n 10.2 Case Application n 10.3 Creating, Reading, Updating, Deleting View n 10.4 Form Design n 10.5 Report.
Chapter 4: Logical Database Design and the Relational Model
Normalization Karolina muszyńska
Chapter 5: Logical Database Design and the Relational Model
Quiz Questions Q.1 An entity set that does not have sufficient attributes to form a primary key is a (A) strong entity set. (B) weak entity set. (C) simple.
CMPE 226 Database Systems February 21 Class Meeting
The Relational Model and Normalization
Relational Database.
CHAPTER 4: LOGICAL DATABASE DESIGN AND THE RELATIONAL MODEL
Database Normalization.
Presentation transcript:

CSS/416 Data Design and Retrieval Workshop 3

CSS/416 Workshop 32 Database Management Systems Terminology Traditional MIS RDBMS Relational Algebra FileTableRelation RecordRowTuple FieldColumnAttribute

CSS/416 Workshop 33 Database management Systems Relational model Based on 1970 paper by E.F. Codd User sees all data in tables Tables can be combined using “set” operations (linked via columns) Metadata also stored in tables as above Logical design separate from physical implementations

CSS/416 Workshop 34 Database Management Systems Functional Dependencies A -> B; A determines B ( A is Determinant ) Partial (PK = AB, B -> C) CustID -> Customer Name

CSS/416 Workshop 35 Database Management Systems Keys Derived from entity identifier One or more attributes ( more = composite key) Uniquely determine a row Functionally determine an entire row’s attributes

CSS/416 Workshop 36 Database management systems SIDActivityFee 100Skiing Swimming50 175Squash50 200Swimming50 Modification Anomalies (multiple themes) - Can’t insert fact that scuba diving cost $175 - Cant update swimming fee - Delete SID 100=>lose skiing data

CSS/416 Workshop 37 Database Normalization Entities should have common theme Stages First Normal form Second Third Others (BCNF, 4 th, 5 th, DK) Impact on referential integrity Denormalize for performance (city, state, zip is classic example)

CSS/416 Workshop 38 Database Normalization 1 st normal form – eliminate multi- valued attributes(repeating groups) 2 nd normal – no partial key functional dependencies 3 rd normal – eliminate transitive dependencies

CSS/416 Workshop 39 Database Normal Forms Violates first normal – why? Plant Name Eqpt Name Plant Mgr Eqpt Mfgr Mfgr Addr ethyleneFinal cooler, feed heater Jim SmithABC Exchanger 1247 Locust styreneFeed pumpBill GunnXYZ Pumps432 Broadway styreneFeed pumpBill GunnABC Exchanger 1247 Locust

CSS/416 Workshop 310 Database Normalization Plant Name Eqpt NamePlant Mgr Eqpt MfgrMfgr Addr ethyleneFinal coolerJim SmithABC Exchanger 1247 Locust ethyleneFeed heaterJim SmithABC Exchanger 1247 Locust styreneFeed pumpBill GunnXYZ Pumps432 Broadway styreneFeed heaterBill GunnABC Exchanger 1247 Locust 1 st Normal satisfied Still violates 2 nd normal– why?

CSS/416 Workshop 311 Database Normalization PlantN ame Eqpt name Eqpt MfgrMfgr Addr ethyleneFinal cooler ABC Exchanger1247 Locust ethyleneFeed heater ABC Exchanger1247 Locust styreneFeed pumpXYZ Pumps432 Broadway styreneFeed heater ABC Exchanger1247 Locust PlantN ame Plant Mgr ethyleneJim Smith styreneBill Gunn 2 nd OK but 3 rd ?

CSS/416 Workshop 312 Database Normalization PlantN ame Eqpt name Eqpt Mfgr ethyleneFinal cooler ABC Exchanger ethyleneFeed heater ABC Exchanger styreneFeed pumpXYZ Pumps styreneFeed heater ABC Exchanger PlantN ame Plant Mgr EthyleneJim Smith styreneBill Gunn Eqpt MfgrMfgr Addr ABC Exchanger 1247 Locust XYZ Pumps432 Broadway Satisfies 3 rd normal form

CSS/416 Workshop 313 Database Normalization BCNF – Every determinant is a candidate key Fourth – Multi-valued dependencies Fifth – Can recombine relations

CSS/416 Workshop 314 Database Normalization Domain Key (DK/NF) Provably free from anomalies But no one way to generate this form All constraints follow from domain definitions and keys

CSS/416 Workshop 315 Database Normalization Domain Key (DK/NF) “The key, the whole key, and nothing but the key”

CSS/416 Workshop 316 Database Design Translating a model to the Database Entities -> tables Establish primary & foreign keys Many-to-many relations ->Junction table Business rules -> triggers, constraints, etc. Surrogate keys Security Typically done with a “CASE” tool

CSS/416 Workshop 317 Database Design Has Employee Auto # One-to-one 1 Auto Emp # 1

CSS/416 Workshop 318 Database Design Makes Mfgr One-to-many Mfgr # 1 N Equipment

CSS/416 Workshop 319 Database Design Has Invoice One-to-many (w/ ID Dependency Inv # 1 N Line Item PK = inv#, item#

CSS/416 Workshop 320 Database Design Mfgr Many-to-many Mfgr_Eqpt Equipment MN Mfg #Eqpt ID

CSS/416 Workshop 321 Database Design Referred by Member Recursive Member # 1 1

CSS/416 Workshop 322 Database Design Member IS-A relationship (Subscriptions) PrintOnline Member#

CSS/416 Workshop 323 Database Design Learning teams to implement sample relations for above E-R relationships: 1 to 1 1 to many Many to many 1 to many w/ ID Dependency Recursive IS-A

CSS/416 Workshop 324 SQL Two main language components Data definition language (DDL) Data manipulation language (DML)

CSS/416 Workshop 325 SQL Data definition language (DDL) Create, alter, drop, etc. Frequently implemented via various CASE tools: Visio, Embarcadero, ERWin, etc. But – also very useful for database administration

CSS/416 Workshop 326 SQL Create Statement Create table patient (name varchar2(35) not null, agesmallint, gendervarchar2(1), account_numberinteger not null, primary keyaccount_number)

CSS/416 Workshop 327 SQL Select (Projection) Select plantname from equipment Select (Restriction) Select * from equipment where eqpt_name = ‘feed heater’

CSS/416 Workshop 328 SQL Select (Selection + projection) Select eqpt_name from equipment where plantname = “styrene” Sorting (Ordering) Select * from manufacturers order by eqpt_mfgr

CSS/416 Workshop 329 SQL There are many built in functions Some are called aggregate functions Count Max Avg Etc. Example Select max(age) from dependents

CSS/416 Workshop 330 SQL Joins (old syntax) Select m.mfgr_addr from manufacturers m, equipment e where m.eqpt_mfgr = e.eqpt_mfgr and e.plantname = ‘styrene’

CSS/416 Workshop 331 SQL Joins (new syntax) Select m.mfgr_addr from manufacturers m inner join equipment e On e.name = m.name where e.plantname = ‘styrene’

CSS/416 Workshop 332 SQL Subqueries Select m.mfg_addr from manufacturers m where eqpt_mfgr in (select e.eqpt_name from equipment e)

CSS/416 Workshop 333 SQL Insert Insert into equipment values(‘propylene’, ‘feed heater’, ‘ABC Exchanger’) Update Update manufacturers Set address = ‘18 Front Road’ Where mfgr_name = ‘ABC Exchanger’

CSS/416 Workshop 334 SQL Delete Delete from equipment Where plant_name = ‘styrene’ And eqpt_name = ‘feed cooler’ How many rows could this delete?

CSS/416 Workshop 335 SQL Exercise Create the tables in the design exercise Create a few sample SQL selects, etc.

Functions of a Database Application Page 238 Figure 10-1 © 2000 Prentice Hall

CSS/416 Workshop 337 CRUD “the first function of a database application is to CRUD views” Create Read Update Delete Page 237

CSS/416 Workshop 338 Format or Materialize views “the second function of a database application; the appearance of the content” Page 238

CSS/416 Workshop 339 Other database functions Enforce constraints Provide for security and control Execute business logic Page 238

E-R Diagram Page 240 Figure 10-3b © 2000 Prentice Hall

Relational Design Page 240 Figure 10-3c © 2000 Prentice Hall

Relational Design (w/ Surrogate Keys) Page 240 Figure 10-3d © 2000 Prentice Hall

Relational Diagram Page 241 Figure 10-3e © 2000 Prentice Hall

CSS/416 Workshop 344 View “A structured list of data items (attributes) from the entities or semantic objects defined in the data model” A view can be materialized or formatted as a form or report Page 242

CSS/416 Workshop 345 Recordset “the result of an SQL statement” Page 243

CSS/416 Workshop 346 CRUD actions on a view Read SELECT CUSTOMER.CustomerID, CUSTOMER.Name FROM CUSTOMER, WORK WHERE CUSTOMER.CustomerID = WORK.CustomerID Page 243

CSS/416 Workshop 347 CRUD actions on a view Create INSERT INTO CUSTOMER (CUSTOMER.Name, CUSTOMER.City) VALUES (NewCust.CUSTOMER.Name, NewCust.CUSTOMER.City) Page 244

CSS/416 Workshop 348 CRUD actions on a view Update INSERT INTO CUSTOMER (CUSTOMER.Name, CUSTOMER.City) VALUES (NewCust.CUSTOMER.Name, NewCust.CUSTOMER.City) Page 246

CRUD actions on a view Delete Cascading deletions depends on relationship cardinality Page 247 Figure 10-6 © 2000 Prentice Hall

CSS/416 Workshop 350 Form “a screen display used for data entry and edit” Forms should... reflect the view structure make data associations graphically clear encourage appropriate action Page 248

CSS/416 Workshop 351 Forms in a GUI Environment Drop-down list Option buttons in groups Check boxes Page 251

GUI controls Page 252 Figure © 2000 Prentice Hall

CSS/416 Workshop 353 Report Design Reports should... reflect the structure of the underlying view handle implied objects Page 253

CSS/416 Workshop 354 Enforcing Constraints Domain Uniqueness Relationship Cardinality 1.1 and 1.N fragments orphans Business Rule triggers Page 256

CSS/416 Workshop 355 Security Horizontal Vertical Page 264

CSS/416 Workshop 356 Control System of menus Transaction boundaries(Atomic unit of work) Page 265