Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 Systems Analysis & Design IS 431: Lecture 9 CSUN Information Systems Database Design.

Similar presentations


Presentation on theme: "1 Systems Analysis & Design IS 431: Lecture 9 CSUN Information Systems Database Design."— Presentation transcript:

1 1 Systems Analysis & Design IS 431: Lecture 9 http://www.csun.edu/~dn58412/IS431/IS431_SP15.htm CSUN Information Systems Database Design

2 IS 431 : Lecture 9 2 Database Design in SDLC

3 IS 431 : Lecture 9 3 Database Design Elements of a Database Evolution of Database Systems DBMS Architecture Relational Data Model and Relational Database Systems

4 IS 431 : Lecture 9 4 A field is the physical implementation of a data attribute. They are the smallest unit of meaningful data. A key (identifier) is a field having unique values to identify one and only one record in a file. A secondary key is an alternate identifier for a record. A descriptive field is any other (non-key) field that stores business data. Data Fields

5 IS 431 : Lecture 9 5 Records A record is a collection of fields arranged in a predefined format. –Fixed-length record structures –Variable-length record structures

6 IS 431 : Lecture 9 6 Files A file is the set of all occurrences of a given record structure. –Types  Master files  Transaction files  Document files  Archival files  Table lookup files  Audit files –File organization: index, sequential … –File access: direct, sequential …

7 IS 431 : Lecture 9 7 Conventional Files vs. the Database File – a collection of similar records. –Files are unrelated to each other except in the code of an application program. –Data storage is built around the applications that use the files. Database – a collection of interrelated files – Records in one file (or table) are physically related to records in another file (or table). –Applications are built around the integrated database

8 IS 431 : Lecture 9 8 Files vs. Database

9 IS 431 : Lecture 9 9 Pros and Cons of Conventional Files Pros: –Easy to design because of their single-application focus –Excellent performance due to optimized organization for a single application Cons –Harder to adapt to sharing across applications –Harder to adapt to new requirements –Need to duplicate attributes in several files.

10 IS 431 : Lecture 9 10 Pros and Cons of Databases Pros: –Data independence from applications increases adaptability and flexibility –Superior scalability –Ability to share data across applications –Less, and/or controlled redundancy (total non-redundancy is not achievable) Cons: –More complex than file technology –Somewhat slower performance –Investment in DBMS and database experts –Need to adhere to design principles to realize benefits –Increased vulnerability due to consolidating data in a centralized database

11 IS 431 : Lecture 9 11 Logical Structure of a Database Inventory SalesCustomer Cash Receipt INVENTORY RECORD Item_No INT(5), non-null, index=itemx Description CHAR(20) Cost CURRENCY (6,2) EXTERNAL LEVEL CONCEPTUAL LEVEL INTERNAL LEVEL VIEW AVIEW BVIEW C

12 IS 431 : Lecture 9 12 Evolution of Database Systems File Management (Flat File) Systems Hierarchical Databases Network Databases Relational Databases Object-Oriented Databases Data Warehouse

13 IS 431 : Lecture 9 13 File Management Systems EMPLOYEE UPDATE PROGRAM FD EMPLOYEE MASTER FILE EMPLOYEE REPORT PROGRAM FD CHECK-WRITING PROGRAM FD TIMECARD FILE

14 IS 431 : Lecture 9 14 Hierarchical Databases Car EngineBodyChassis Left Door Right Door Hood Roof HandleWindowLock

15 IS 431 : Lecture 9 15 Network Databases Acme Mfg. First Corp. Size 4 Widget 4D Bolt #11231#11232#11233#11234#11235 CUSTOMERSPRODUCTS ORDERS

16 IS 431 : Lecture 9 16 Relational Databases CUSTOMERSPRODUCTS ORDERS CUST ID PRODUCT ID ORDER # 1 1 QUANTITY M M

17 IS 431 : Lecture 9 17 Object-Oriented Databases CUSTOMERS Add Customer Drop Customer Change Customer PRODUCTS CUST ID CUST NAME ADDRESS PRODUCT ID PRICE QTY-ON HAND New Product Buy Product Sell Product ORDERS ORDER # CUST ID PRODUCT ID QUANTITY Take Order Drop Order Method Data 11 * *

18 IS 431 : Lecture 9 18 Data Warehouse

19 IS 431 : Lecture 9 19 Difficulties of Non-Relational Tables Update Anomaly: not changing all occurrence of a data item (in many places) Insert Anomaly: add an invalid (null record) to the database Delete Anomaly: not remove all info (in many places) about a deleted record

20 IS 431 : Lecture 9 20 Relational Data Model Table (Relation) –Row : specific occurrence of an entity –Column : characteristic of an entity, must be single-valued and same data type for all occurrences Primary Key: unique identifier of an occurrence of an entity (entity integrity) Foreign Key: to link tables together, must be null or corresponding to value of a primary key in another table (referential integrity)

21 IS 431 : Lecture 9 21 Requirements of Relational Data Model Primary Key must be unique Foreign Key must either be null or corresponding to existing value of a primary key of another table (to link with this table) Column describes a characteristic of an object identified by primary key Column is single-value ( ex: not “$100, $250” ) Values in rows of a specific column must be of the same data type Column order or row order are unimportant

22 IS 431 : Lecture 9 22 Database Integrity Entity integrity: error exists when identifiers (primary keys) are not unique to identify specific instances of the entity (2 customers have a same identification) Referential integrity: error exists when a foreign key value in one table has no matching primary key value in the related table (Sell to non-existing customers) Domain integrity:error exists when field value is outside the range (a pencil costs $100,000 !!!)

23 IS 431 : Lecture 9 23 Data Architecture A business’s data architecture defines how that business will develop and use files and databases to store all of the organization’s data; the file and database technology to be used; and the administrative structure set up to manage the data resource. Data is stored in some combination of: –Conventional files –Operational databases (also called transactional databases) –Data warehouses –Personal databases –Work group databases

24 IS 431 : Lecture 9 24 A Modern Data Architecture

25 IS 431 : Lecture 9 25 Database Architecture Database architecture refers to the database technology including the database engine, database utilities, CASE tools, and database development tools. A database management system (DBMS) is specialized software that is used to create, access, control, and manage the database. The core of the DBMS is a database engine. –A data definition language (DDL) is that part of the engine used to physically define tables, fields, and structural relationships: (CREATE TABLE; ALTER TABLE …) –A data manipulation language (DML) is that part of the engine used to create, read, update, and delete records in the database, and navigate between different files (tables) in the database: (INSERT; SELECT… FROM …WHERE…)

26 IS 431 : Lecture 9 26 Typical DBMS Architecture

27 IS 431 : Lecture 9 27 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.

28 IS 431 : Lecture 9 28 Normalization Revisited First normal form (1NF) : –No repeating group of a same attribute –If not: create a new entity for this group. Second normal form (2NF) –Attributes depend on the (composite) key, not part of it. –If not: create a new entity for these partial depended attributes Third normal form (3NF) –Attributes depend on the (primary) key only, not on each other –If not: create new entity for these partial depended attributes

29 IS 431 : Lecture 9 29 Database Models An Entity Relationship Diagram (ERD) is the logical model of the data requirements (data to be stored in the system and their relationships. A Database Schema (physical data model) is the blueprint of the planned implementation of the logical model. One can also use Relational Data Model as a blueprint of relational database design.

30 IS 431 : Lecture 9 30 Physical Data Types Logical Data Type to be stored in field) Physical Data Type MS Access Physical Data Type Microsoft SQL Server Physical Data Type Oracle Fixed length character data (use for fields with relatively fixed length character data) TEXT CHAR (size) or character (size) CHAR (size) Variable length character data (use for fields that require character data but for which size varies greatly--such as ADDRESS) TEXT VARCHAR (max size) or character varying (max size) VARCHAR (max size) Very long character data (use for long descriptions and notes- -usually no more than one such field per record) MEMOTEXT LONG VARCHAR or LONG VARCHAR2 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

31 IS 431 : Lecture 9 31 Physical Data Types … Logical Data Type to be stored in field) Physical Data Type MS Access Physical Data Type Microsoft SQL Server Physical Data Type Oracle 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 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

32 IS 431 : Lecture 9 32 Data Distribution Data distribution analysis establishes which business locations need access to which logical data entities and attributes.  Centralization  Horizontal distribution (Data partitioning: Rows or Records)  Vertical distribution (Data partitioning: Columns or Attributes)  Replication

33 IS 431 : Lecture 9 33 Data Distribution Options Store all data on a single server (Centralization) Store specific tables on different servers. Store subsets of a specific table on different servers –Subsets of columns (Vertical Partitioning) –Subsets of rows (Horizontal Partitioning) Replicate (duplicate) specific tables or subsets on different servers for back up (Replication)

34 IS 431 : Lecture 9 34 Database Distribution Vertical partitioning

35 IS 431 : Lecture 9 35 Database Distribution Horizontal partitioning

36 IS 431 : Lecture 9 36 Database Distribution

37 IS 431 : Lecture 8 37 Database Distribution

38 IS 431 : Lecture 9 38 Relational Databases Relational databases implement stored data in a series of two-dimensional tables that are “related” to one another via foreign keys. –The physical data model is called a schema. –The DDL and DML for a relational database is called SQL (Structured Query Language). –Triggers are programs embedded within a table that are automatically invoked by updates to another table. –Stored procedures are programs embedded within a table that can be called from an application program.

39 IS 431 : Lecture 9 39 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 an index for each primary and secondary key. 5.Create an 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 and specify referential integrity constraints.

40 IS 431 : Lecture 9 40 From Logical Data Model Customer Cust No Order Order No Product Product No CUSTOMER (Cust No, ….) ORDER (Order No, Cust No, ….) PRODUCT (Product No,…) ORDER-PRODUCT (OrderNo, ProductNo, …) place contain (1,1)(1,M) (1,N)

41 IS 431 : Lecture 9 41 to Physical Data Model (Relational Schema) …

42 IS 431 : Lecture 9 42 …to “MS Access” Implementation.

43 IS 431 : Lecture 9 43 Database Components Database Engine Database Form Builder Report Writer Interactive Query Tool Application Program Database Front-end Database Gateway To other computer systems To other DBMS brands

44 IS 431 : Lecture 9 44 The Role of SQL Database Engine Database Form Builder Report Writer Interactive Query Tool Application Program Database Front-end Database Gateway To other computer systems To other DBMS brands SQL

45 IS 431 : Lecture 9 45 Administrators Data administrator is responsible for the data planning, definition, architecture, and management in the organization. (CIO) Database administrators are responsible for the database technology, database design and construction, security, backup and recovery, and performance tuning. (Supervisors)


Download ppt "1 Systems Analysis & Design IS 431: Lecture 9 CSUN Information Systems Database Design."

Similar presentations


Ads by Google