14-1 Goals of Database Design A database should provide for efficient storage, update, and retrieval of data. A database should be reliable—the stored.

Slides:



Advertisements
Similar presentations
Data Definition and Integrity Constraints
Advertisements

Chapter 10: Designing Databases
Irwin/McGraw-Hill Copyright © 2000 The McGraw-Hill Companies. All Rights reserved Whitten Bentley DittmanSYSTEMS ANALYSIS AND DESIGN METHODS5th Edition.
Database Management Systems, R. Ramakrishnan and J. Gehrke1 The Relational Model Chapter 3.
SQL Lecture 10 Inst: Haya Sammaneh. Example Instance of Students Relation  Cardinality = 3, degree = 5, all rows distinct.
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.
Cs3431 Constraints Sections 6.1 – 6.5. cs3431 Example CREATE TABLE Student ( sNum int, sName varchar (20), prof int, CONSTRAINT pk PRIMARY KEY (snum),
14.1 Dr. Honghui Deng Assistant Professor MIS Department UNLV MIS 370 System Analysis Theory.
IS 4420 Database Fundamentals Chapter 6: Physical Database Design and Performance Leon Chen.
CS 432 Object-Oriented Analysis and Design
Relational Model Stores data as tables –Each column contains values about the same attribute –Each column has a distinct name –Each row contains values.
McGraw-Hill/Irwin Copyright © 2007 by The McGraw-Hill Companies, Inc. All rights reserved. Chapter 14 Database Design.
1 Relational Model. 2 Relational Database: Definitions  Relational database: a set of relations  Relation: made up of 2 parts: – Instance : a table,
Irwin/McGraw-Hill Copyright © 2004 The McGraw-Hill Companies. All Rights reserved Whitten Bentley DittmanSYSTEMS ANALYSIS AND DESIGN METHODS6th Edition.
The Relational Model Lecture 3 Book Chapter 3 Relational Data Model Relational Query Language (DDL + DML) Integrity Constraints (IC) From ER to Relational.
Murali Mani SQL DDL and Oracle utilities. Murali Mani Datatypes in SQL INT (or) INTEGER FLOAT (or) REAL DECIMAL (n, m) CHAR (n) VARCHAR (n) DATE, TIME.
SQL Keys and Constraints Justin Maksim. Key Declaration Key constraint defined within the CREATE TABLE command Key can be declared using either the PRIMARY.
SQL DDL constraints Restrictions on the columns and tables 1SQL DDL Constraints.
McGraw-Hill/Irwin Copyright © 2007 by The McGraw-Hill Companies, Inc. All rights reserved. Chapter 14 Database Design.
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.
Chapter 14 & 15 Conceptual & Logical Database Design Methodology
Oracle Data Definition Language (DDL)
1 Systems Analysis & Design IS 431: Lecture 9 CSUN Information Systems Database Design.
Irwin/McGraw-Hill Copyright © 2000 The McGraw-Hill Companies. All Rights reserved Whitten Bentley DittmanSYSTEMS ANALYSIS AND DESIGN METHODS5th Edition.
Chapter 4 The Relational Model.
Chapters 17 & 18 Physical Database Design Methodology.
An Investigation of Oracle and SQL Server with respect to Integrity, and SQL Language standards Presented by: Paul Tarwireyi Supervisor: John Ebden Date:
Irwin/McGraw-Hill Copyright © 2000 The McGraw-Hill Companies. All Rights reserved Whitten Bentley DittmanSYSTEMS ANALYSIS AND DESIGN METHODS5th Edition.
SQL Data Definition (CB Chapter 6) CPSC 356 Database Ellen Walker Hiram College (Includes figures from Database Systems by Connolly & Begg, © Addison Wesley.
McGraw-Hill/Irwin© 2008 The McGraw-Hill Companies, All Rights Reserved Chapter 13 Database Design.
Database Technical Session By: Prof. Adarsh Patel.
SQL Server 7.0 Maintaining Referential Integrity.
Chapter 6 1 © Prentice Hall, 2002 The Physical Design Stage of SDLC (figures 2.4, 2.5 revisited) Project Identification and Selection Project Initiation.
CSC 2720 Building Web Applications Database and SQL.
Oracle Data Definition Language (DDL) Dr. Bernard Chen Ph.D. University of Central Arkansas Fall 2008.
FALL 2004CENG 351 File Structures and Data Management1 Relational Model Chapter 3.
FEN Introduction to the database field:  The Relational Model Seminar: Introduction to relational databases.
© 2009 Pearson Education, Inc. Publishing as Prentice Hall 1 Chapter 7 (Part a): Introduction to SQL Modern Database Management 9 th Edition Jeffrey A.
The University of Akron Dept of Business Technology Computer Information Systems The Relational Model: Concepts 2440: 180 Database Concepts Instructor:
Constraints cis 407 Types of Constraints & Naming Key Constraints Unique Constraints Check Constraints Default Constraints Misc Rules and Defaults Triggers.
Oracle 11g: SQL Chapter 4 Constraints.
Chapter 4 Constraints Oracle 10g: SQL. Oracle 10g: SQL 2 Objectives Explain the purpose of constraints in a table Distinguish among PRIMARY KEY, FOREIGN.
File and Database Design Class 22. File and database design: 1. Choosing the storage format for each attribute from the logical data model. 2. Grouping.
Irwin/McGraw-Hill Copyright © 2004 The McGraw-Hill Companies. All Rights reserved Whitten Bentley DittmanSYSTEMS ANALYSIS AND DESIGN METHODS6th Edition.
GLOBEX INFOTEK Copyright © 2013 Dr. Emelda Ntinglet-DavisSYSTEMS ANALYSIS AND DESIGN METHODSINTRODUCTORY SESSION EFFECTIVE DATABASE DESIGN for BEGINNERS.
Physical Database Design Purpose- translate the logical description of data into the technical specifications for storing and retrieving data Goal - create.
McGraw-Hill/Irwin Copyright © 2007 by The McGraw-Hill Companies, Inc. All rights reserved. Chapter 14 Database Design.
Constraints Lesson 8. Skills Matrix Constraints Domain Integrity: A domain refers to a column in a table. Domain integrity includes data types, rules,
©Silberschatz, Korth and Sudarshan1 Structured Query Language (SQL) Data Definition Language Domains Integrity Constraints.
CS34311 The Relational Model. cs34312 Why Relational Model? Currently the most widely used Vendors: Oracle, Microsoft, IBM Older models still used IBM’s.
McGraw-Hill/Irwin Copyright © 2007 by The McGraw-Hill Companies, Inc. All rights reserved. Chapter 14 Database Design.
McGraw-Hill/Irwin Copyright © 2007 by The McGraw-Hill Companies, Inc. All rights reserved. Chapter 14 Database Design.
Relational Database Management System(RDBMS) Structured Query Language(SQL)
Irwin/McGraw-Hill Copyright © 2004 The McGraw-Hill Companies. All Rights reserved Whitten Bentley DittmanSYSTEMS ANALYSIS AND DESIGN METHODS6th Edition.
1 10 Systems Analysis and Design in a Changing World, 2 nd Edition, Satzinger, Jackson, & Burd Chapter 10 Designing Databases.
INFORMATION TECHNOLOGY DATABASE MANAGEMENT. A database is a collection of information organized to provide efficient retrieval. The collected information.
Constraints Advanced Database Systems Dr. AlaaEddin Almabhouh.
CDT/1 Creating data tables and Referential Integrity Objective –To learn about the data constraints supported by SQL2 –To be able to relate tables together.
Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke1 The Relational Model Chapter 3.
1 CS122A: Introduction to Data Management Lecture #4 (E-R  Relational Translation) Instructor: Chen Li.
CENG 351 File Structures and Data Management1 Relational Model Chapter 3.
1 Agenda TMA02 M876 Block 4. 2 Model of database development data requirements conceptual data model logical schema schema and database establishing requirements.
McGraw-Hill/Irwin Copyright © 2007 by The McGraw-Hill Companies, Inc. All rights reserved. Chapter 14 Database Design.
Getting started with Accurately Storing Data
Fundamentals of DBMS Notes-1.
Managing Tables, Data Integrity, Constraints by Adrienne Watt
Module 5: Implementing Data Integrity by Using Constraints
Chapter 14 Database Design Chapter 14 – Database Design.
The Relational Model Relational Data Model
Presentation transcript:

14-1 Goals of Database Design A database should provide for efficient storage, update, and retrieval of data. A database should be reliable—the stored data should have high integrity and promote user trust in that data. A database should be adaptable and scalable to new and unforeseen requirements and applications. A database should support the business requirements of the information system.

14-2 A Method for Database Design 1.Review the logical data model. 2.Create a table for each entity. 3.Create fields for each attribute. 4.Create index for each primary & secondary key. 5.Create index for each subsetting criterion. 6.Designate foreign keys for relationships. 7.Define data types, sizes, null settings, domains, and defaults for each attribute. 8.Create or combine tables to implement supertype/subtype structures. 9.Evaluate/specify referential integrity constraints.

14-3 Database Integrity Key integrity – Every table should have a primary key. Domain integrity – Appropriate controls must be designed to ensure that no field takes on an inappropriate value Referential integrity – the assurance that a foreign key value in one table has a matching primary key value in the related table. No restriction Delete: cascade Delete: restrict Delete: set null

14-4 Data Types for Different Database Technologies (cont.) Logical Data Type to be stored in field) Physical Data Type MS Access Physical Data Type MS SQL Server Physical Data Type Oracle Integer number NUMBER INT (size) or integer or smallinteger or tinuinteger INTEGER (size) or NUMBER (size) Decimal numberNUMBER DECIMAL (size, decimal places) or NUMERIC (size, decimal places) DECIMAL (size, decimal places) or NUMERIC (size, decimal places) or NUMBER Financial NumberCURRENCYMONEY see decimal number Date (with time) DATE/TIME DATETIME or SMALLDATETIME Depending on precision needed DATE Current time (use to store the data and time from the computer’s system clock) not supported TIMESTAMP not supported

14-5 Data Types for Different Database Technologies (cont.) Logical Data Type to be stored in field) Physical Data Type MS Access Physical Data Type MS SQL Server Physical Data Type Oracle Yes or No; or True or False YES/NOBIT use CHAR(1) and set a yes or no domain ImageOLE OBJECT IMAGELONGRAW HyperlinkHYPERLINK VARBINARYRAW Can designer define new data types? NO YES

14-6 Physical Database Schema

14-7 Database Schema with Referential Integrity Constraints

14-8 Database Distribution and Replication Data distribution analysis establishes which business locations need access to which logical data entities and attributes.

14-9 Database Distribution and Replication (continued) Centralization Entire database on a single server in one physical location Horizontal distribution (also called partitioning) Tables or row assigned to different database servers/locations. Efficient access and security Cannot always be easily recombined for management analysis Vertical distribution (also called partitioning) Specific table columns assigned to specific databases/servers Similar advantages and disadvantages of Horizontal Replication Data duplicated in multiple locations DBMS coordinates updates and synchronization Performance and accessibility advantages Increases complexity

14-10 Database Capacity Planning For each table sum the field sizes. This is the record size. For each table, multiply the record size times the number of entity instances to be included in the table (planning for growth). This is the table size. Sum the table sizes. This is the database size. Optionally, add a slack capacity buffer (e.g. 10percent) to account for unanticipated factors. This is the anticipated database capacity.

14-11 SQL DDL Code CREATE TABLE [dbo].[ClassCodes] ( [ClassID] [Integer] Identity(1,1) NOT NULL, [DepartmentCodeID] [varchar] (3) NOT NULL, [SectionCodeID] [varchar] (2) NOT NULL, [ClassCodeID] [varchar] (5) NOT NULL, [GroupCodeID] [varchar] (1) NOT NULL, [ClassDescription] [varchar] (50) NOT NULL, [ValidOnLine] bit NULL, [LastUpdated] [smalldatetime] NULL ) ON [PRIMARY] GO Alter Table [dbo].[ClassCodes] Add Constraint pk_classcodes Primary Key (ClassID) Alter Table [dbo].[ClassCodes] Add Constraint df_classcodes_groupcodeid Default 'A' for GroupCodeID Alter Table [dbo].[ClassCodes] Add Constraint fk_classcodes_sectioncodes Foreign Key (DepartmentCodeID,SectionCodeID) References SectionCodes(DepartmentCodeID,SectionCodeID) Alter Table [dbo].[ClassCodes] Add Constraint un_classcodes_Dept_Section_Class Unique (DepartmentCodeID,SectionCodeID,ClassCodeID) GO