DATABASE DESIGN
*Database – a collection of interrelated files
– Records in one file (or table) are physically related to
Analisis dan Perancangan Sistem Informasi records in another file (or table).
– Applications are built around the integrated database
Universitas Katolik Parahyangan
2019 14-2
14-3 14-4
1
Fields
*Pros and Cons of Databases
Field – the smallest unit of meaningful data
Pros Cons to be stored in a database
• Data independence from • More complex than file
technology – the physical implementation of a data attribute
applications increases
adaptability and flexibility • Somewhat slower Primary key – a field that uniquely identifies a record.
performance
• Superior scalability Secondary key– a field that identifies a single record or a
• Investment in DBMS and subset of related records.
• Ability to share data across database experts
applications Foreign key– a field that points to records in a different file.
• Need to adhere to design
• Less, and controlled principles to realize Descriptive field– any nonkey field.
redundancy (total non- benefits
redundancy is not • Increased vulnerability due
achievable) to consolidating data in a
centralized database
14-5 14-6
14-7 14-8
2
Files and Tables Data Architecture
• Previous file design methods required that the Data architecture– a definition of how:
– Files and databases are to be developed and used to store data
analyst specify precisely how the records in a – The file and/or database technology to be used
database should be: – The administrative structure set up to manage the data resource
– Sequenced (File organization) Data is stored in some combination of:
– Accessed (File access) – Conventional files
– Operational databases– databases that support day-to-day operations
• Database technology usually predetermines and transactions for an information system. Also called transactional
databases.
and/or limits this – Data warehouses– databases that store data extracted from operational
databases.
– Trained database administrator may be given some • To support data mining
– Personal databases
control over organization, storage location, and access – Work group databases
methods for performance tuning.
14-9 14-10
14-11 14-12
3
Database Architecture Typical DBMS Architecture
Database architecture– the database technology used to
support data architecture
– Including the database engine, database utilities, CASE tools, and
database development tools.
14-13 14-14
4
… To Physical Data Model (Relational User Interface for a Relational PC
Schema) DBMS
14-17 14-18
14-19 14-20
5
Conventional File Design Goals of Database Design
• Output and input designs typically completed first • A database should provide for efficient storage,
• Fundamental entities from data model designed update, and retrieval of data.
as master or transaction records
– Master files are typically fixed-length records • A database should be reliable—the stored data
– Associative entities from data model are joined into should have high integrity and promote user trust
transaction records as variable-length records
in that data.
• File access and organization selected
– Sequential
– Indexed • A database should be adaptable and scalable to
– Hashed new and unforeseen requirements and
– ISAM/VSAM applications.
14-21 14-22
14-23 14-24
6
Data Types for Different Database
A Method for Database Design Logical Data Type
Technologies
to be stored in field)
Physical Data
Type MS Access
Physical Data Type
Microsoft SQL Server
Physical Data Type
Oracle
7. Define data types, sizes, null settings, domains, and field per record)
defaults for each attribute. Integer number NUMBER INT (size) or
integer or
INTEGER (size) or
NUMBER (size)
8. Create or combine tables to implement supertype/ smallinteger or
tinuinteger
subtype structures. Decimal number NUMBER DECIMAL (size, decimal DECIMAL (size, decimal
9. Evaluate and specify referential integrity constraints. places) or
NUMERIC (size, decimal
places) or
NUMERIC (size, decimal
places) places) or
NUMBER
14-25 14-26
14-27 14-28
7
Database Schema with Referential
Database Integrity
Integrity Constraints
• 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 tat 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-29 14-30
8
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