DAT602 Database Application Development Lecture 4 Database Design.

Slides:



Advertisements
Similar presentations
Chapter 10: Designing Databases
Advertisements

BUSINESS DRIVEN TECHNOLOGY Plug-In T4 Designing Database Applications.
Data Design The futureERD - CardinalityCODINGRelationshipsDefinition.
Microsoft Access Removing Redundancy in a Database.
Database Design Conceptual –identify important entities and relationships –determine attribute domains and candidate keys –draw the E-R diagram Logical.
Methodology Logical Database Design for the Relational Model
Normalization of Database Tables
PowerPoint Presentation for Dennis, Wixom & Tegarden Systems Analysis and Design Copyright 2001 © John Wiley & Sons, Inc. All rights reserved. Slide 1.
Chapter 4: Database Management. Databases Before the Use of Computers Data kept in books, ledgers, card files, folders, and file cabinets Long response.
Chapter 5 Normalization of Database Tables
Database Systems Design, Implementation, and Management Coronel | Morris 11e ©2015 Cengage Learning. All Rights Reserved. May not be scanned, copied or.
Chapter 4 Relational Databases Copyright © 2012 Pearson Education, Inc. publishing as Prentice Hall 4-1.
Database Systems: Design, Implementation, and Management Eighth Edition Chapter 5 Normalization of Database Tables.
Keys Chapter 8 Database Design for Mere Mortals. Why Keys Are Important They ensure that each record in a table can be properly identified. They help.
July 14, 2015ICS 424: recap1 Relational Database Design: Recap of ICS 324.
Database – Part 2a Dr. V.T. Raja Oregon State University.
Chapter 4 Relational Databases Copyright © 2012 Pearson Education 4-1.
Oracle Data Definition Language (DDL)
Daniel AdinugrohoDatabase Programming 1 DATABASE PROGRAMMING Lecture on 29 – 04 – 2005.
COMPUTING FOR BUSINESS AND ECONOMICS-III. Lecture no.6 COURSE INSTRUCTOR- Ms. Tehseen SEMESTER- Summer 2010.
5.1 © 2007 by Prentice Hall 5 Chapter Foundations of Business Intelligence: Databases and Information Management.
Week 6 Lecture Normalization
Computers Are Your Future Tenth Edition Chapter 12: Databases & Information Systems Copyright © 2009 Pearson Education, Inc. Publishing as Prentice Hall1.
1 Chapter 1 Overview of Database Concepts. 2 Chapter Objectives Identify the purpose of a database management system (DBMS) Distinguish a field from a.
CSCI 3140 Module 2 – Conceptual Database Design Theodore Chiasson Dalhousie University.
Organizing Data and Information AD660 – Databases, Security, and Web Technologies Marcus Goncalves Spring 2013.
Database Systems: Design, Implementation, and Management Tenth Edition
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.
MS Access: Creating Relational Databases Instructor: Vicki Weidler Assistant: Joaquin Obieta.
CSC 2720 Building Web Applications Database and SQL.
Oracle Data Definition Language (DDL) Dr. Bernard Chen Ph.D. University of Central Arkansas Fall 2008.
1 n 1 n 1 1 n n Schema for part of a business application relational database.
Slide 1 Object Persistence Design Chapter 13 Alan Dennis, Barbara Wixom, and David Tegarden John Wiley & Sons, Inc. Slides by Fred Niederman Edited by.
Instructor: Dema Alorini Database Fundamentals IS 422 Section: 7|1.
Chapter 1Introduction to Oracle9i: SQL1 Chapter 1 Overview of Database Concepts.
DataBase Management System What is DBMS Purpose of DBMS Data Abstraction Data Definition Language Data Manipulation Language Data Models Data Keys Relationships.
6.1 © 2010 by Prentice Hall 6 Chapter Foundations of Business Intelligence: Databases and Information Management.
Prepared By Prepared By : VINAY ALEXANDER ( विनय अलेक्सजेंड़र ) PGT(CS),KV JHAGRAKHAND.
DAT602 Database Application Development Lecture 2 Review of Relational Database.
Database Design. The process of developing database structures from user requirements for data a structured methodology Structured Methodology - a number.
Advanced Web 2012 Lecture 3 Sean Costain What is a Database? Sean Costain 2012 A database is a structured way of dealing with structured information.
Database Fundamentals CSC105 Furman University Peggy Batchelor.
Relational Databases. Relational database  data stored in tables  must put data into the correct tables  define relationship between tables  primary.
Lection №4 Development of the Relational Databases.
BSA206 Database Management Systems Lecture 2: Introduction to Oracle / Overview of Database Concepts.
1 DATABASE TECHNOLOGIES (Part 2) BUS Abdou Illia, Fall 2015 (September 9, 2015)
Copyright © 2013 by The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill/Irwin APPENDIX C DESIGNING DATABASES APPENDIX C DESIGNING DATABASES.
Chapter 4 Logical & Physical Database Design
Flat Files Relational Databases
Mr C Johnston ICT Teacher
NORMALIZATION. What is Normalization  The process of effectively organizing data in a database  Two goals  To eliminate redundant data  Ensure data.
Understand Primary, Foreign, and Composite Keys Database Administration Fundamentals LESSON 4.2.
Object storage and object interoperability
* Database is a group of related objects * Objects can be Tables, Forms, Queries or Reports * All data reside in Tables * A Row in a Table is a record.
6.1 © 2007 by Prentice Hall Chapter 6 (Laudon & Laudon) Foundations of Business Intelligence: Databases and Information Management.
1 10 Systems Analysis and Design in a Changing World, 2 nd Edition, Satzinger, Jackson, & Burd Chapter 10 Designing Databases.
1 Microsoft Access 2002 Tutorial 2 – Creating And Maintaining A Database.
What Is Normalization  In relational database design, the process of organizing data to minimize redundancy  Usually involves dividing a database into.
SQL Basics Review Reviewing what we’ve learned so far…….
Data Resource Management Lecture 8. Traditional File Processing Data are organized, stored, and processed in independent files of data records In traditional.
1 Section 1 - Introduction to SQL u SQL is an abbreviation for Structured Query Language. u It is generally pronounced “Sequel” u SQL is a unified language.
NORMALISATION OF DATABASES. WHAT IS NORMALISATION? Normalisation is used because Databases need to avoid have redundant data, which makes it inefficient.
Revised: 2 April 2004 Fred Swartz
Chapter 4 Relational Databases
Normalization Referential Integrity
(Winter 2017) Instructor: Craig Duckett
Teaching slides Chapter 8.
Relational Database Model
Database.
Presentation transcript:

DAT602 Database Application Development Lecture 4 Database Design

Database Application Development - Lecture 4 Basic structure of database application Three ties model Database is the foundation of whole system. Generally, we should design database at very beginning. Database Application server (Business logic) Client (User interface)

Database Application Development - Lecture 4 Analyze Requirement Requirement analysis is complicated. For database design you should consider which kinds of data are necessary for the expecting system? The more careful you consider it, the less risk of modifying database you’ll take in the future.

Database Application Development - Lecture 4 In this lecture, we’ll use a Mini online shop as a example to demonstrate how to design a simple database. Basic requirement: Sellers can put products online. Buyers can view and buy available products. Details of transaction should be kept.

Database Application Development - Lecture 4 Mini Online shop How many entities should be involved in this system? Customers, sellers, products, transaction. Create one table for each entity. CustomerSellerProductTransaction Tables

Database Application Development - Lecture 4 Design a table Which data is needed for each table? What types of these data? How long of data is appropriate? Which column should be primary key?

Database Application Development - Lecture 4 Table design Which data is needed for each table? Only cover necessary and close related data. ColumnType NameChar IDChar Char TelephoneChar HeightFloat Unnecessary

Database Application Development - Lecture 4 Table design What types of these data? Float, integer, char, date, etc.. Different databases have different type systems, but they are similar. char vs. varchar The char is a fixed-length character data type, the varchar is a variable-length character data type.

Database Application Development - Lecture 4 Table design How long of data is appropriate? 8bit, 32bit, 128bit? Longer data costs more storage. Consider carefully. 1 Chinese character = 2 byte = 16 bit

Database Application Development - Lecture 4 Table design Which column should be chosen as primary key? Chose the column will never have two same values. Primary key is used to identify different records.

Database Application Development - Lecture 4 Customer table. Column NameTypeLength(Byte) UserNamechar16 Addresschar128 TelephoneNOchar16 UserIDchar16 char32 Balancefloat16 Primary Key

Database Application Development - Lecture 4 Transaction table Column NameData typeLength TransactionIDchar16 Datedate16 BuyerIDchar16 SellerIDchar16 ItemIDchar16 Amountfloat16 TotalPricefloat16 Primary Key Foreign Key

Database Application Development - Lecture 4 Relationship between tables ColumnType TransactionIDchar BuyerIDchar SellerIDchar …… ColumnType UserIDchar UserNamechar …… ColumnType SellerIDchar SellerNamechar …… Primary key Foreign key

Database Application Development - Lecture 4 Normalization Normalization eliminates redundancies and to ensure consistent dependencies. Simply, normalization refines database design.

Database Application Development - Lecture 4 Normalization guideline There must be no repeated fields. The table cannot contain fields that are not related to the primary key. For a multiple keys table, the table should only contain data related to one entity, and that entity should be described by its primary key. The table cannot contain two or more independent multivalued facts about an entity.

Database Application Development - Lecture 4 There must be no repeated fields. ColumnType UserIDChar FullNameChar SurnameChar …… Fullname and Surname are conflict, remove Surname or keep Surname and use GivenName to replace Fullname. ColumnType UserIDChar GivenNameChar SurnameChar …… Customer table Normalized Customer table

Database Application Development - Lecture 4 The table cannot contain fields that are not related to the primary key. ColumnType UserIDChar UserNameChar TransactionIDChar …… For customer table, TransactionID is not a part of customer information, but a part of transaction, you should remove it. ColumnType UserIDChar UserNameChar …… Customer table Normalized Customer table

Database Application Development - Lecture 4 For a multiple keys table, the table should only contain data related to one entity, and that entity should be described by its primary key. ColumnType TransactionIDChar BuyerIDChar SellerIDChar BuyerNameChar …… Primary key Foreign key Transaction Table ColumnType TransactionIDChar BuyerIDChar SellerIDChar …… Normalized Transaction Table

Database Application Development - Lecture 4 The table cannot contain two or more independent multi-valued facts about an entity. UserID (Primary Key) Telephone …… Customer Table UserID (Primary Key) Telephone1Telephone …… Normalized Customer Table Primary key can not has two records with same value.

Database Application Development - Lecture 4 View Views are implemented in a relational database system by allowing the user to select data from the database to create temporary tables, known as views.

Database Application Development - Lecture 4 TransactionIDDateUserIDUserNameUserTelephoneSeller…. TransactionCustomerSeller View of detailed transaction Tables

Database Application Development - Lecture 4 Keep each table as simple as possible, just assign necessary columns to it, you can create views by combining data from multiple tables.

Database Application Development - Lecture 4 Literature “Java Database Programming Bible”, by John O'Donahue ISBN: John Wiley & Sons © 2002 Chapter 2