0% found this document useful (0 votes)
41 views78 pages

Database Management System Nirupma Pathak Download

The document is a comprehensive overview of the Database Management System (DBMS) by Nirupma Pathak, covering fundamental concepts, data modeling, relational data models, SQL, database design, transaction processing, concurrency control, and data mining. It includes detailed chapters on various aspects of DBMS, such as data independence, normalization, and recovery techniques. Additionally, it provides insights into the advantages and disadvantages of using a DBMS compared to traditional file systems.

Uploaded by

gabrilarfian
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
41 views78 pages

Database Management System Nirupma Pathak Download

The document is a comprehensive overview of the Database Management System (DBMS) by Nirupma Pathak, covering fundamental concepts, data modeling, relational data models, SQL, database design, transaction processing, concurrency control, and data mining. It includes detailed chapters on various aspects of DBMS, such as data independence, normalization, and recovery techniques. Additionally, it provides insights into the advantages and disadvantages of using a DBMS compared to traditional file systems.

Uploaded by

gabrilarfian
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 78

Database Management System Nirupma Pathak

download

https://ebookbell.com/product/database-management-system-nirupma-
pathak-51754194

Explore and download more ebooks at ebookbell.com


Here are some recommended products that we believe you will be
interested in. You can click the link to download.

Database Management System 1st Edition Jagdish Chandra Patni

https://ebookbell.com/product/database-management-system-1st-edition-
jagdish-chandra-patni-50782804

Database Management Systems Fasttrack Patricia Ward George Dafoulas

https://ebookbell.com/product/database-management-systems-fasttrack-
patricia-ward-george-dafoulas-48047452

Database Management Systems 1st Edition V Vidhya G Jeyaram Kr Ishwarya

https://ebookbell.com/product/database-management-systems-1st-edition-
v-vidhya-g-jeyaram-kr-ishwarya-51627268

Database Management Systems 2nd Edition Vijay Krishna Pallaw

https://ebookbell.com/product/database-management-systems-2nd-edition-
vijay-krishna-pallaw-4128142
Database Management Systems Xpress Learning Itl Education Solutions
Limited

https://ebookbell.com/product/database-management-systems-xpress-
learning-itl-education-solutions-limited-10881218

Database Management Systems Mu G K Gupta

https://ebookbell.com/product/database-management-systems-mu-g-k-
gupta-10945050

Database Management Systems 3rd Edition Raghu Ramakrishnan Johannes


Gehrke

https://ebookbell.com/product/database-management-systems-3rd-edition-
raghu-ramakrishnan-johannes-gehrke-1338516

Database Management Systems Applications Kogent Learning Solutions Inc

https://ebookbell.com/product/database-management-systems-
applications-kogent-learning-solutions-inc-231673804

Database Management Systems 3rd Edition Raghu Ramakrishnan Johannes


Gehrke

https://ebookbell.com/product/database-management-systems-3rd-edition-
raghu-ramakrishnan-johannes-gehrke-50688856
DATABASE
AGE ME NT
SYSTEM

NIRUPMA PATHAK
M. Tech (CS & Engg.)
Assistant Professor
Department of Computer Application
Lal Bahadur Shastri Institute of Management and Development Studies
LUCKNOW

K4»jI
'HiIDalaya Gpublishing 'House
• Mumbai. Delhi. Bangalore. Hyderabad. Chennai
• Ernakulam. Nagpur. Pune. Ahmedabad. Lucknow '-
© No part of this book shall be reproduced, rerpinted or translated for any purpose whatsoever without
prior permission of the publisher in writing.

ISBN :978-81-84881-39-4
First Edtion 2008

Published by Mrs. Meena Pandey


for HIMALAYA PUBLISHING HOUSE,
"Ramdoot", Dr. Bhalerao Marg, Girgaon, Mumbai-400 004.
Phones: 23860170123863863 Fax: 022-23877178
Email: himpub@vsnl.com
Website: www.himpub.com
Branch Offices
Delhi "Pooja Apartments", 4-B, Murari Lal Street, Ansari Road,
Darya Ganj, New Delhi-I 10 002
Phones: 23270392, 23278631 Reliance: 3r .! 80392 to 396
Fax: 011-23256286 Email: hphdel@vsnl.com
Nagpur Kundanlal Chandak Industrial Estate, Ghat Road,
Nagpur-440 018
Phone . 272 I 2 16, Telefax: 0712-272 I 2 i 5
Hangalore No. 16/1 (old 1211), 1st floor, Next to Hotel Highland,
Mndhava Nagar. Race Course Road, Bangalore-560 001
Phones' 22281541. 22385461 Fax: 080-Q2866 I 1
Hyderabad No. 2-2-1 167/2H. I st Floor, Near Railway Bridge, TIlak Nagar.
MaIO Road. Hyderabad-SOO 044
Phonc . 26501745. Fax: 040-27560041
Chennai No.2. Rama Knshna Street. North Usman Road.
T-Nagar, Chennai -600 01 7
Phone: 28144004. 28144005 Mobile: 09380460419
Pune No. 527. "Laksha" Apartment. First Floor. Mehunpura.
Shaniwarpeth, (Near Prabhat Theatre). Pune-411 030
Phonc . 020-24496333. 24496333. 24496323
Lucknow C-43. Sector C. Ali Gunj. Lucknow - 226 024
Phone: 0522-4047594
Ahmedabad I 14. Shail. 1Sl Floor, Opp. Madhu Sudan House.
e.G. Road. Navrang Pura, Ahemdabad-380 009
Mobile: 9327324149
Eranakulam No. 3911 04A. Lakshmi Apartment. Karikkamurj Cross Road
Eranakulam. Cochin-622 01 l. Kerala
Phone. 0484-2378012. 2378016
Typeset at Elite-Art, Daryaganj, New De!hi-! IO 002
Printed at A to Z Printers, Daryaganj, New Delhi-! 10002
Contents

1. Introduction 1-13
An Overview of Database Management System
Database System vs. File System 4
Database System Concepts Architecture 4
Data Models 6
Schema and Instances 8
Data Independence 9
Database Language and Interfaces 9
Data Definitions Language 10
Data Manipulation Language (DML) 10
Overall Database Structure 11
DBMS Users 12

2. Data Modeling Using the Entity Relationship Model 14-62


ER Model Concepts 14
Notation for ER Diagram 17
Mapping Constraints 18
Key Concepts of Super key, Candidate Key. Primary Key 21
Generalization 22
Aggregation 24
Reduction of an ER Diagrams to Tables 25
Extended Model 28
Relationships of Higher Degree 28

3. Relational Data Model and Language 63-84


Relational Data Model Concepts 63
Integrity· Constraints 66
Entity Integrity 66
Referential Integrity 66
Keys Constraints 67
Domain Constraints 67
Relational Algebra 70
Relational Calculus 80
Tuple and Domain Calculus 82

4. Introduction to SQL 85-110


Characteristics of SQL 85
Advantage-of SQL 86
SQL Data Types and Literals. 86
Types of SQL Commands 87
SQL Operators and Their precedence 88
Tables, Views and Indexes 89
Queries and Sub Queries 89
Aggregate Functions 90
Insert, Delete and Update Operations 91
Joins, Unions, Intersection, Minus 92
Cursors in SQL 92

5. Database Design and Normalization 111-151


Functional Dependencies 111
Normal Forms (Normalization) 114
First Normal Form (INF) 120
Second Normal Form (2NT) 121
Third Normal Form (3NF) 121
BCNF (Boyce Cold Normal Form) 124
Los~ Less Join Decompositions (Normalization using FD (Functional
Dependencies), MVD (Multivalued Dependencies), and JD (Join
Dependencies) 127
Inclusion Dependencies 128
Alternative Approaches to Database Design 129
6. Transaction Processing Concepts 152-172
Transaction System 152
Testing of Serializability 162
Serializability of Schedules 162
Conflict and View Serializable Schedule 163
Recoverability 164
Recovery from Transaction Failures 165
Log based Recovery 168
Check Points 170
Deadlock Handling 171

7. ~oncurrency Control Techniques 173-199


Concurrency Control 173
Locking Techniques for Concurrency Control 173
Time Stamping Protocol for Uncurrency Control 178
Validation based Protocol 179
Multiple Granularity 180
Multi Version Schemes 182
Recovery with Concurrency Transaction 183
Transaction Processing in Distributed System 183
Data Fragmentation 184
Replication 187
Allocation Techniques for Distributed System 188
Overview of Concurrency Control and Recovery Distributed Database. 188

8. Data Mining and Data Warehousing 200-240


Data Mining 200
Data Mining Background 203
Data Mining Models 205
Da~a Warehousing 206
DataWarehousing Models ·206
Data Mining Functions 211
Data Mining Techniques 213
On Line Analytical Processing 218
Siftware - Past and Present Developments 221
Venders and Applications 226
Data Mining Examples 234
The Scope of Data Mining 237
Architecture/or Data Mining 238

Examination Papers 241-318


Introduction
Chapter Outline ------------------------1
An Overview of Database Management System
, Database System vs. File System
: Database System Concepts Architecture
Data Models
Schema and Instances
Data Independence
Database Language and Interfaces
Data Definitions Language
Data Manipulation Language (DML)
Overall Database Structure
DBMS Users

AN OVERVIEW OF DATABASE MANAGEMENT SYSTEM


DBMS can divide the term into two parts one is database and other is management system.

1. Database
A database is a collection of related information stored so that it is available to many users for
different purposes.
Fundamental of Database: (1) Field (2) Record (3) File (4) Database (5) Key field
1. Field. The smallest piece of meaningful information in a file is called a data item or field.

NAME LOCALITY I I CITY STATE I


(Fields or Dataitem)
IPINCODE
2. Record. The collection of related fields is called a rec.ord .
1. Ram . 118, Shamina Road .J LKO - UP 226003

(1) .' ---


2 DATABASE MANAGEMENT SYSTEM

3. File. File is the collection of all related records.


Field Name
NAME LOCALITY CITY STATE PIN CODE

I I. Ram 198. Shamina Road LKO U.P 226003


I
T T Record J
Field contents Field contents
2. Sita 108. Mohan Road Allahabad U.P. 21]001

Record 2

4. Database. Database is a collection of interrelated files.


5. Key Field. The key field in a record is a unique dataitem which is lIsed to identify the record
for the purpose of accessing and manipulating database.
Field 1 Field 2 Field 1 Field 2 Fields 1 Field 2

Fields

Relating Key Fields

Record of 100 Record of 100 Record of 100


Employee Employees. Employee.
Records (Contain
related fields)

Files (Contain Files 1 contains File 2 contains File 3 centains


related records) 100 Records of 100 Records of 100 Records of
Employees Employees Employees

Data base (contain


File 1 File 2 File 3
interrelated files)
DATABASE MANAGEMENT SYSTEM 3

2. Management System
Management System is a collection of programs that enables users to create and maintain the
database.
So "A DBMS is a collection of interrelated files and a set of programs that allow users to
access and modify these tiles. The system hide!) contain details of how the data is stored and
maintained."

Advantages of DBMS
1. Redundancy and Inconsistency can be Reduced. In traditional file system, if same
database is to be used by multiple applications then we have to create the separate file for each
application which gives a considerable duplicity in the stored data resulting wastage of minor
space.
But in DBMS, DBA (Database Administrator) has the centralized control of the data. DBMS
allows the sharing of data under its control by any number of applications
2. Data Independence. DBMS allows the Data Independence at two level, physical Data
Independence base and logical Data Independence.
Data Independence is one of the main advantage of DBMS.
The ability to modify a schema definition in one level without affecting a schema definition in
the next higher level is called data independence.
I. Physical Data Independence: POI (Physical Data Independence) is the ability to modify
the physical schema without causing application programs to be rewritten.
2. Logical Data Independence: LDI (Logical Data Independence) is the ability to modify
the conceptual schema without causing application program to be rewritten.
3. Efficient Data Access. A DBMS provides so many techniques to store and retrieve the data
efficiently.

Disadvantages of DBMS
I. Problems associated with centralization
2. Cost of software and hardware incurred in the application of DBMS is its major
disadvantages.
3. Complexity of backup and recovery.
4 DATABASE MANAGEMENT SYSTEM

DATABASE SYSTEM VS. FILE SYSTEM


File Processing System Database System
1. In fik [lrLH:l!sslng !>y~lem. the system stores I. In the database systL!m, there eXists a collection
pcrmalll:nL records 111 various liIes. Application of interrelated rIles and a set of application
program~ are need to extract record~ from and programs to acess and modify these liles. Details
add records to appropnatl! liIes. As time passes of Data storage and maintenance are hidden from
new files and corresponding application programs the users.
arc added to the system.
2. Supported by conventIOnal operating ~ystems
2. A database system may be generated
;,ueh a!> MSDOS. automatically or it may be computerized.
,. Smce the file~ and application programs are 3. A database system so deSigned does not involve
created by different programmers over a long to problem of data redundancy or inconsistency
period of time, data In files is likely to get
repeated. Redundancy can lead to inconSistency
that I~ the various copies of the same data
may cL!rtain different Information.

DATABASE SYSTEM CONCEPTS ARCHITECTURE


It gIve, three type~ of level

1. Internal Schema (Physical level)


The lowest level of abstraction describes how the data are actually stored.

C=~
,
I . I

I I
i
I Hard disk
I:

I,
2. Logical Level (Conceptual Schema)
The next higher level of absraction describes data stored. What data are stored in the database
and what relationship exists among those data.
DATABASE MANAGEMENT SYSTEM 5

, ~\ \
I Customer \

\,~
!
I
Custom~\ (~)
home ) ID
I

Customer Account

Logical level (Conceptual schema)

3. External Schema (View Level)


I. The highest level of abstraction describes only part of the entire database. Schemas are not
change frequently. The overall logical design of the database is called database schema.
2. Schema~ are changed infrequently. Data changes over time as information is inserted and
deleted. The collection of information stored in the database at a particular moment is called instance
of database.

Schema

~
Name Age Sex Address

Instance .-- ~

Student Schema (Name. Age. Sex, Address)


View Level
6 DATABASE MANAGEMENT SYSTEM

End users

enceptual setema

internal
schema

Three level architecture of DBMS

DATA MODELS
A data model is collection of conceptual tools for describing data their relationships, data
semantic~ and consistency constraints:
1. Hierarchical Model
2. Network Model
3. Relational Model
4. Object Oriented Model
5. Object Relational Model

1. Hicranchical Model. The hierarchy model uses parent child relationships. These are 1 : N
mapping between record types.
This is done by lIsing the tree concept. Because in a hierarchical database the parent child
relationship is one to many, this restricts a child segment to have only one parent segment.
DATABASE MANAGEMENT SYSTEM 7

Hierarchical Model Representation

2. NetwOl"k model: In hierarchical model in can not have more than one parent per child,
which may be necessary for some application so. the Network model permitted the modeling of
many to many relationships in data.

I EmTee I
EMP-SAL

t
Salary

Network Representation

The Network model can be graphically represented a~ follows:


A labeled rectangle represents that corresponding entity or record type. A arrow represents the
set type, which denotes the relationship between the owner record type and member record. The
arrow direction in the owner record type to the member record type. In Figure two record types.
Employee and salary and the set type EMP-SAL with employee a~ the owner type salary as the
member record type.

3. Relational Model. In relational model the data and the relations among them are represented
by a collectiull ot tables. A table is a collection of records and each record in a table contains the
same fields.
A descnption of data in terms of a Data model is called a schema.
Database may be stored in a relation with the following schema.
8 DATABASE MANAGEMENT SYSTEM

STUDENT
Roll No. Integer
Name String
Class String
Address String
This schema has 4 fields with field names and types as mentioned the Data in this schema can
be !.hown as

Roll No Name Class Address


100 Ram B. Teach (CS) Noida

Above three models are called record based data model.

4. Object Oriented Model : Object DBMS add database functionality to object programming
languages. Object DBMS extend the schematics of the C++ and JAVA object programming Languages
to provide full features database programming capability. The object programming language gives
one to one mapping. This one to one mapping object programming language to database objects has
two benetits over other storage approaches. It provides high performance management of objects
and it enables better management to the inter -relationships between objects.
5. Object Relational Model: Object relational database management systems (ORDBMS)
add new object storage capability the relational system at the core of modern information system.

SCHEMA AND INSTANCES


Students Schema

~
Name Age Sex Address

~
Stude'nls
Instan ce~
DATABASE MANAGEMENT SYSTEM 9

Schemas are not change frequently. The overall logical design of the database is called the
database schema. Schemas are changed in frequently data changes over time as information is
inserted and deleted. The collection of information stored in the database at a particular moment is
called instance of database.

DATA INDEPENDENCE - ADVANTAGE OF DBMS


DATA LANGUAGE AND INTERFACES
1. DBMS languages
1. DDL (Data Definition Language)

2. SDL (Storage Definition Language)


3. VDL (View Definition Language)
4. DML (Data Manipulation Language)

1
I l
High Level or Non Procedural DML Low Level or Procedural DML
(HL or NPDML) (LLorPDML)
J- -l-
is called record at a time DML is called set at a - time or set oriented DMLs.

I. DOL is lIsed by the DBA and by database designers to define both schemas (conceptual and
internal)
2. SDL is used to specify the internal schema.
3. VDL to specify user views and their mappings to the Conceptual Schema.
4. In DML manipulations include retrieval, insertion deletion and modification of the data.
5. A HL or NPDML can be used on at own to specify complex database operations.
6. ALL or PDML mllst be embedded in a general purpose programming language. A query in
a high level PML often specifies which data to retrieve rather them how to retrieve it, hence
slIch languages are also called declarative.

2. DBMS interfaces
User friendly interfaces for interacting with the database these can also be lIsed by casual users.
User friendly interfaces provided by a DBMS may include the following:
10 DATABASE MANAGEMENT SYSTEM

1. Menu-Based interfaces for Browsing. These interfaces present the user with lists of options
called menu that lead the user through the formulation of a request browsing interfaces which allow
a used to look through the contents of a database is unstructured manner.
2. Forms Based interfaces: A form based interface displays a form to each user.
3. Graphical user Interfaces (GUn: A OUI typically displays a schema to the user in
diagrammatic form. Most OUIs use a pointing device.
4. Natural language Interfaces (NLI) : A NLlusually has its own schema which is similar to
the database conceptual schema.
5. Interfaces for Parametric users: Parametric users. such as bank tellers. often have a small
set of operations that they must perform repeatedly.
6. Interfaces for DBA: Most database systems contain privileged commands that can be used
only be the DBA's staff.
7. DDL (Data Definition Language). A database schema is specified by a set of definitions
expressed by a special language called a DDL. The result of compilation of DDL statement is a set
of table~ i.e. stored in a special file called data dictionary or data directory.
Data dIctionary means data about data.

DATA MANIPULATION LANGUAGE


DML (Data manipulation language). By data manipulation we mean
I. The retrieval of information stored in the database.

2. The insertion of new information into the database.


3. The deletion of information from the database.
4. The modification of information stored in the database.
A DML is the language that enables users to access for manipulate data as organized by the
appropriated data model.
DML is two types:
I. Procedural DML requires a user to specify what data are needed and how to get those data,
for example Relation Algrea.

2. Non-procedural DML requires a uses to specify what data are needed and have if not get
those data,for example Relation Calculus.
DATABASE MANAGEMENT SYSTEM 11

OVERALL DATABASE STRUCTURE


End users Application
(Unsophisticated) programmers DBA DBA

Application Application Database


Interface program Schema

I DDL I
~
precompiler Query
Processor

Query_
processor /
Storage
Manager

Filemanager

,--_D_a_ta_F_i1e_s_-,1 \
Disk Storage

Data Dictionary

Overall System Architecture

The major components of a DBMS are as follows.


1. DDL Compiler: The DDL statements are sent to the DDL compiler, which converts these
statements to a set of tables. These tables contain the metadata concerning the database and are in a
form that can be used by other compound of the DBMS.
12 DATABASE MANAGEMENT SYSTEM

2. DML Precompiler and Query Processor: The DML pre-compiler converts the DML
statements embedded in an application program to normal procedure collision the host language. If
tpe
. DML statements include the queries then it goes to query processor. which interprets the query
and converts it into an efficient services of operation!>. thus finding a good strategy for executing the
query. The query processor also users the date dictionary.
3. Data Manager: Data manager control the database. It provide the interface between the
database and application program!>.
4. File Manager: File manager is responsible for allocation of space on disk storage and the
data structure~ u~ed to represent II1formation stored on physical media.
5. Data Files: These are the tiles. which contain the data.
6. Data Dictionary: Data Dictionary is used to store the metadata that is the data about the
data.

DBMS USERS
1. Naive Users: Naive users are end users of the database who work through a menu driven
application program where the type and range of response is always indicated to the user.
2. Online USC1'S : Online users are those who may communicate with the database directly via
an on-line terminal or indirectly via a user interface and application program.
3. Application Programmers: Professional programmers are those who are responsible for
developing application program or user interface.
4. DBA: One of the main reasons for using DBMS is to have central control over both the data
and the programs that access those data. The person who has sllch control over the system is called
the Database administrator (DBA).
The functional of DBA include the following:
( I) Schema Definition : The DBA create a original Database schema by writing a set of
detinition1..
(2) Storage Structure and Method Definition: The DBA a creates appropriate storage structure
and access method by writing a set of definitions.
(3) Granting of' Authorization for Data Access: The authorization information is kept in a
speCial system structure.
(4) Integrity Constraint Spectification: No. of hours an employee may work in one week
may not exceed a specified limit. Such a constntint must be specified explicitly by the
Database administration (DBA).
DATABASE MANAGEMENT SYSTEM 13

, Emp. No. Emp. Name Attributes No. of hours

In figure no of hours on employee may work in one week may not exceed a specified limit.
Such a constraint must be specified expli'citly by the Database administration (DBA).
Data Modeling Using the
Entity Relationship Model
Chapter Outline -----------------------1
ER model concepts
f'Jotation for ER diagram
Mapping constraints
Key concepts of Super key, Candidate key, Primary key
Generalization
Aggregation
Reduction of an ER diagrams to tables
Extended model
Relationships of higher degree

ER (ENTITY RELATIONSHIP MODEL)


I. An entity is thing or object in a real world that is distinguishable from all other objects, for
example-person, place
2. Attribute: An object or entity is characterized by its properties (~r attributes)
• Weak and Strong Entity sets: A entity set may not have sufficiently attributes to form a
primary key such an entity set is termed as weak entity set.
• An entity set that has a primary key is termed as strong entity set.
3. Entity set. An entity set is a set of entities of the same type that share the same properties or
attributes .
• An entity is represented by a set of attributes.
• Each entity has a value for each of its attributes.
• For each attribute, there is a set of permitted values, called the domain or value set.

Every weak entity set can be converted to a strong entity set by adding appropriate and reverse
is not possible .
(14)
DATABASE MANAGEMENT SYSTEM 15

Simple and Composite Attributes


Simple Attribute~ are not divided into subparts Composite Attributes, can be divided into subparts.
( I. e Qther attri butes).

Customer ID Customer Name Customer Street Customer City


1001 Ram North Harrison
1002 Mohan Main Woodside
1003 Sohan North Harrison

Customer Name Customer Address

first middle last Street State Postal


name initial code

Street number Street name Apartment number

COMPOSITE ATTRIBUTES CUSTOMER NAME AND CUSTOMER


ADDRESS
Single Valued and Multi Valued Attributes
The attributes all have a single value for a particular entity loan number attribute for a specific
loan entity refers to only one loan number. Such attributes are said to be single valued. An employee
entity set with the attribute phone number. An employee may have zero, one, or several phone
numbers, and different employees may have different numbers of phones. This type of attribute is
said to be multi-valved.

Derived Attribute
The value for this type of attribute can be derived from the values of other related attributes or
entities.
Example: Suppose that the customer entity set has an attribute age, which indicates the
fustomer's age. If the customer entity set also has an attribute date of birth, we can calculate age
from date of birth and the current date. Thus, age is a derived attribute.
An attribute takes a null value when on entity does not have a value for it.
• A relationship is an associatIon among several entities.
16 DATABASE MANAGEMENT SYSTEM

• A relationship set is a set of relationships of the same type Customer Loan


~----------------------~
Cust. ID Cust. Name Cust. Street Cust. City Loan
110 Loan value
~------------------~
1001 Ram North Harrison L-5 1000
1002 Mohan Main wood side L-14 2000

Relationship set between Customer and Loan


This relationship specifices that Ram is a customer with loan number L - 15.
In relationship set is a mathematical relation on 11 ~ 2 entity sets. If (E I , E2 ..... En> are entity sets,
then a relationship set Ris asubsetof(e l ,e2-e.)l e, E E 1,e2 E E 2...... e"E E,,} where (e l ,
-- e) ZlS a relationship.
e is relationship
E is the entit), set
Consider the two entity sets customer and loan in Fig. we define the relationship set borrower to
denote the association between customers and the bank loans.
attributes
/
~
Emp. No. Emp. Name Designation Salary Dept. No.

do main

f\ f":J.\ ... of
set
~
- I \ I \

1 J \ I d
c:

5-
\ / a Q)
\.J '0
'0
-- ~ 'cc:o
E
o
'0
Entity set
For each attribute, there is a set of permitted values. called the domain or value set of that
attribute.
• An entity is representation by a set of attributes.
• An entity type is a collection of entities that share a common definition.
DATABASE MANAGEMENT SYSTEM 17

NOTATION FOR ER DIAGRAM


Symbol Meaning

Rectangles
o which represent entIty sets

Double rectangles
-\

D which represent weak entity sets

Diamonds which

Ellipses
o
--0
represent Relationship set~

which represent attributes

Lines which link attributes to entity


sets and entity sets to relationship
sets.

Ellipses with Line which represenet key attribute

Double Ellipses which represent multivalued

--
attributes

Dashed ellipses I \ which denote


double lines --I I deri ved-atiri butes
\
-- /
~hlch indicate total participa-
tion of an entity in a
relationship set.
18 DATABASE MANAGEMENT SYSTEM

For example

Cust-
name

Cust-city

Customer Loan

E-R diagram correspondisng to customers and loans

MAPPING CONSTRAINTS
Mapping cardinalities or constraints express the no. of entities to which another entity can be
associated via a relationship set for a binary relationship set R between entity set A and B. The
mapping cardinality must be one of the following:
1. One to One mapping: An entity in A is associated with almost one entity in B. And an entity
in B is assocIated with almost an entity in A.

One to One
DATABASE MANAGEMENT SYSTEM 19

E;n~ ___
Cust-street

Customer
---0_ oan
_ _----'

One to One mapping

2. One to Many Mapping. An entity in A is associated with any no of entities in B. An entity in


B can be associated with almost one entity in A.

A B
One to many mapping

Customer Borrower Loan

One to many mapping


20 DATABASE MANAGEMENT SYSTEM

3. Many to One Mapping. An entity in A is associated with almost one entity in B. An entity in
B can be associated with any number of entities in A .

Many to one mapping

Customer Loan

Many to one mapping

4. Many to Many Mapping. An entity in A is associated with any number of entities in Band
an entity in B can be associated with any number of entities in A.

Many to many mapping


DATABASE MANAGEMENT SYSTEM 21

Customer Loan

Many to many mapping

Notes: Arrow only add both side in one to one mapping, only right side in many to one mapping,
only left side in one to many mapping.

KEY CONCPETS OF SUPERKEY, CANDIDATE KEY, PRIMARY KEY


Keys: It is important to able to specify how entities within a given entity set and relation ships
within given relationship set are distinguished.
Superkey : A superkey is a set of one or more attributes that taken collectively allow us to
identify uniquely an entity in the entity set.
For example the customer-id, attribute of the entity set customer is sufficient to distinguish one
customer entity from another. Thus costumer-id is a superkey. The combination of customer-name
and customer-id is a superkey for the entity set customer. The customer name attribute of customer
is not a superkey because several people might have the same name. If K is a superkey then so is any
superkey of K. we are often interested in superkeys for which no proper subset is a superkey. Such
minimal superkeys are called candidate key.
Primary key: Primary key to denote a candidate key that is chosen by the database designer as
the principal means of identifying entities within an entity set.
For example:
Student entity set

Roll No. Social security No. Father's name


22 DATABASE MANAGEMENT SYSTEM

In it tv"o attributes Roll No, Social Security No can uniquely identify a thing. But Both of them
can not be considered as superkey together. Thus only are attribute must be used to identify the
thing uniquely where by database designers. This most preferable attribute is known as primary
ke}.

EXTENDED ER FEATURES SPECIFICATION


Specification: An entity set may include subgroupings of entities that are distinct in some way
from other entities in the set.
The bank could then c~eate two specializations of account, namely savings-account and checking-
accounts.
Savings account entities are described by the attribute "interest rate" where as checking account
entItIes are described by the attributes "Overdraft amount". The process of designating subgroups
with1l1 an entily set is called specializations.
The specification of account allows us we distinguish among accounts based on the type of
account. The bank may offer the following three types of checking accounts.
1. A standard checking account.
2. A gold checking account
3. A senior checking account.
The specification of checking account by account lype yield the following entity set.
I. Standards with attribute number checks ..
2. Gold, with attributes min-balance and interest payment.
3. Senior with attribute date of birth specification is the Top down process.
Specification : Top down process
Generalization: Bottom up process
DATABASE MANAGEMENT SYSTEM 23

Savings Checking
account account

Standard Senior

Gold

Top down approach (Specification)

Generalization: The design process may also proceed in a bottom-up manner in which multiple
entity sets are synthesized into a higher level entity set on the basis of common features. The database
designes may have first identified a checking account entity set units attributes overdraft amount
. balance-no. Acs and a savings account quantity set with the attribute interest rate account-no., balance.
24 DATABASE MANAGEMENT SYSTEM

Account

Savings Checking
account account

Generalization (Bottom up approach)

AGGREGATION
Aggregation is a new feature of the E-R modeling. Though E-R modeling has one limitation
that it can express relationships. So this drawback is overcome by aggregation. We use aggregation
technique where we want to express relationship among.
In this E- R diagram we have two relationship sets.
• Belongs to
• Written by.
These two relationships can be combined into one single relationship set. but this combination
of relationship is not recommended, because it may not present logically correct structure of this
schame. To present the logically correct structure of this scheme. we will use the aggregation
techmque.
DATABASE MANAGEMENT SYSTEM 25

Subject

Author

Author-ID

Aggregation

REDUCTION OF AN E-R DIAGRAMS TO TABLES


We convert ER diagram to tables: We can devide this ER diagram into three
rections:
1. Strong Entity sets (Division, Dept. Manger. Employees)
2. Weak entity sets (Dependents)
3. Relationship sets (contains, managed - by. have, dependents - ot)
26 DATABASE MANAGEMENT SYSTEM

employeesl----<.

E-Rdiagram

1. Reducing Strong Entity sets into tables consider the qntity sets Division of the E-R diagram.
This entity set has two attributes Div-id and Div - name. We shall represent this entity set by a table
called division with two columns,

Division id Division name


01 Marketing DivIsion

Division Relation

Similarly entity set 'Dept' has two id Dept - no and D- name, which will be represented by table
Dept.
Dept no D-name
DEPT 01 New Business Department
DEPT 02 Education Department

Department Relation
DATABASE MANAGEMENT SYSTEM 27

entit), set manager also has two id, Mgr id and Mgr - name which will be replacement (by table
manager)
Mgr Id Mgr Name
MGOI Ram
MG02 Sohan
Manager Relation

Entity set Employee has to ID, Emp. no and Emp. name which will be represented by table
employee.
Ernp. No. Emp. ~arne

1001 Ram
1002 Ashok
1003 Rahu
1004 Rahul

Employe Relation

2. Reducing weak entity sets into tables


In the ER diagram we have only one weak entity set depandent. This entity set has three attributes
Name, Age and Relationship. The dependent is dependent on the primary key EMP - No. of entity
type employee. Thus Dependent is represented by a table with your columns EMP-NO, 1 Name,
Age and Relationship as shown in below fig.
EMP-No Name Age Relationship
1001 Ram 10 Son
1001 Mohan 12 Son
1002 Sita 8 Daughter
1006 Ravi II Daughter

Dependent Relation

3. Producing Relationship sets in Tables


In E-R diagram, we have four relationship sets contains, Managed-by, Have, Dependents of
1. Contains: relationship set involves two entity sets dividison with primary key Div-id and
Dept with primary key Dept. no I
28 DATABASE MANAGEMENT SYSTEM

Div-id Dept-no
01 DEPT 01
02 DEPT 02

Contains Relation

2. Managed By: relationship set involves two entity sets kept with primary key dept no. and
manager units primary key Mgr-id

Dept no Mgr-id
DEPT 01 Ram
PEPT02 Mohan

Managed by Relation

3. Have: relationship set involves two entity sets Dept with primary key Dept and Employee
with primary key Emp-no.

Dept-no Emp-no
DEPT 01 1001
DEPT 01 1002
DET02 1003
DL-T02 1004
Have Relation

Lastly we shall deal with the case of relationship set dependents of, linking a weak entity set
(Dependent) to its corresponding strong entity set (Employee).

EXTENDED ER MODEL (EER MODEL)


The EER models include all the modeling concepts of the ER model and the concepts of subclass.
super class. specialization, and generalization.

RELATIONSHIPS OF HIGHER DEGREE


We have defined the degree of relationship type as the number of participating entity types. If
there are two entity types participating in a relation then it is called a relationship type of degree two
DATABASE MANAGEMENT SYSTEM 29

(binary). and a relationship types in called degree three (ternary) if there are three entity types
participating. If there is a relationship that involves N entities is called N-ary relationship.

Person
~ ____________~Spouse
Spouse

Binary relationship

In thi!> tigure a marriage for example is a relation between a man and woman that is modeled by
a relationship set marriage between two instances of entities derived from the entity set person.

Student Course

Computing
system

Ternary relationship

Ternary relationship involving three entities sets - Computing represents the relationship
involving a student using a particular computing system to do the computations for a given course.
Example 1. What is a database?
A database is a well organized collection of data that are related in a meaningful way which can
be accessed in different logical orders but are stored only once. The datu in the database is therefore
Integrated. structured and shared.
30 DATABASE MANAGEMENT SYSTEM

Example 2. What are the main features of database?


The main features of data in a database are:
• It is well organized
• It i5. related
• It is accessable in different orders without great difficulty
• It i~ stored only once
Example 3. \"'hat is a DBMS?
To be able to carry out operations like insertion, deletion and retrievaL the database needs to be
managed by a substantial package of software. This software is usually called a Database Management
System (DBMS). The primary purpose of a DBMS is to allow a user to store, update and retrieve
data in abstract terms and thus make it easy to maintain and retrieve information from a database. A
DBMS relieves the user from having to know about exact physical representations of data and
havlOg to specify detailed algorithms for storing, updating and retrieving data. To provide the various
facilities to dIfTerent types of users, a DBMS normally provides one or more specialized programming
languages often called Database Languages. Different DBMS provide different database languages
although a language called SQL has recently taken on the role of de facto standard.
Example 4. What are the advantages of using the DBMS approach?
• Redundancies and inconsistencies can be reduced
The data in conventional data systems is often not centralised. Some applications may require
data to be combined from several systems. These several systems could well have data that is
redundant as well as inconsistent (that is, different copies of the same data may have different
values). Date inconsistencies are often encoutered 10 everyday life.
• Better service to the Users
In conventional systems. availability of information is often poor since it normally is difficult to
obtain information that the existing systems were not designed for. Once several conventional ~ystems
are combined to form one centralised data base, the availability of information and its up-to-dateness
is likely to improve since the data can now be shared and the DBMS makes it easy to respond to
unforeseen information requests.
Centralizing the data in a database also often means that user can obtain new and combined
information that would have been impossible to obtain otherwise. Also. use of a DBMS should
allow users that do not know programming to interact with the data more easily.
The ability to quickly obtain new and combined information is becoming increasingly important
in ah environment where various levels of governments are requiring organisations to provide more
and more information about their activities. An organisation running a conventional data processing
DATABASE MANAGEMENT SYSTEM 31

system would require new programs to be written (or the Information compiled manually) to meet
every new demand.
• Flexibility of the system is improved
Changes are often necessary to the contents of data'stored in any system. These changes are
more easIly made in a database than in a conventional system in that these changes do not need to
have any impact on application programs.
• Cost of developing and maintaining systems is lower
Although the initial cost of setting up of a database can be large, one normally expects the
overall cost of setting up a database and developing and maintaining application programs to be
lower than for similar service using conventional systems since the productivity of programmers
can be substantially higher in using non-procedural languages that have been developed with modern
DBMS than using procedural languages.
• Standards can be enforced
Since all access to the database must be through the DBMS, standards are easier to enforce.
Standards may relate to the naming of the data, the format of the data, the structure of the data etc.
• Security can be improved
Setting up of a database makes it easier to enforce security restrictions since the data is now
centralized. It is easier to control who has access to what parts of the database. However, setting up
a database can also make it easier for a determined person to breach security.
• Integrity can be improved
Integrity may be compromised in many ways. For example, someone may make a mistake in
data input and the salary of a full-time employee may be input as $4,000 rather than $40,000. A
student may be shown to have borrowed books but has no enrolment. Salary of a staff member in
one department may be coming Ollt of the budget of another department.
Controls therefore must be introduced to prevent such errors to occur. However, since
all data is stored only once, it is often easier to maintain integrity than in conventional
systems.
• Enterprise requirements can be identified
All enterprises have sections and departments and each of these units often consider the work of
their unit as the most important and therefore consider their needs as the most important. Once a
database has been set up with centralised control. it will be necessary to identify enterprise
requirements and to balance the needs of competing units. It may become necessary to ignore some
requests for information if they conflict with higher priority needs of the enterprise.
• Data model must be developed
Perhap~ the most important advantage of setting up a database system is the requirement that an
32 DATABASE MANAGEMENT SYSTEM

overall data model for the enterprise be built. In conventional systems. it is more likely that files
will be designed as needs of particular applications demand. The overall view is often not considered.
Building an overall view of the enterprise data, although often an expensive exercise. is usually very
cost-effective in the long term.
Example 5. What are the disadvantages of using the DBMS approach?
A database system generally provides on-line access to the database for many user. In contrast,
a conventional system is often designed to meet a specific need and therefore generally provides
access to only a small number of user. Because of the larger number of users accessing the data
when a database IS used, the enterprise may involve additional risks as compared to a conventional
data processing system in the following areas:
• Confidentiality. Privacy and Security
When information is centralised and is made available to users from remote locations, the
possibilities of abuse are often more than in a conventional data processing system. To reduce the
chances of unauthorised users accessing sensitive information, it is necessary to take technical,
administrative and, possible, legal measures.
Most databases store valuable information that must be protected against deliberate trespass
and destmction.
• Data Quality
Since the database is accessible to user remotely, adequate controls are needed to control users
updating data and to control data quality. With increased number of user accessing data directly,
there are enormous opportunities for user to damage the data. Unless there are suitable controls, the
data quality may be compromised.
• Data Integrity
Since a large number of users could be using a database concurrently, technical safeguards are
necessary to ensure that the data remain correct during operation. The main threat to data integrity
comes from several different users attempting to update the same data at the same time. The database
therefore needs to be protected against inadvertent changes by the users.
• Enterprise Vulnerability
Centralising all data of an enterprise in one database may mean that the database becomes an
indispensable resource. The survival of the enterprise may depend on reliable information being
available from its database. The enterprise therefore becomes vulnerable to the destruction of the
database or to unauthorised modification of the database.
• The Cost of using a DBMS
Conventional data processing systems are typically designed to mn a number of well-defined,
preplanned processes, Such systems are often "tuned" to mn efficiently for the processes that they
DATABASE MANAGEMENT SYSTEM 33

were designed for. Although the conventional systems are usually fairly inflexible in that new
applications may be difficult to implement and or expensive to run, they are usually very efficient
for the applIcations they are designed for.
The database approach on the other hand provides a flexible alternative where new applications
can be developed relatively inexpensively. The flexible approach is not without its costs and one of
these costs is the additional cost of running applications that the conventional system was designed
for. Using standardised software is almost always less machine efficient than specialised software.
Example 6. What are the main components of a DBMS?
A database management system is a complex piece of software that usually consists of a number
of modules. The DBMS may be considered as an agent that allows communication between the
various types of users with the physical database and the operating system without the users being
aware of every detail of how it is done. To enable the DBMS to fulfil its tasks, the database
management system must maintain information about the data itself that is stored in the system.
This information would normally include what data is stored. how it is stored, who has access to
what parts of it and so on.
A database management system is often used by two different type of users. Firstly, there are
llsers who pose ad hoc queries and updates, which are usually executed only once. Then there are
users that use canned programs that are installed on the system by application programmers. These
programs language are often used repeatedly. The database system must provide query language
and an embedded host language to meet the needs of these two types of users.
In addition, a DBMS provides facilities for
1. describing the database. when a database is being set up
2. authorization specification and checking
3. access path selection
4. logging and recovery
5. and many more.
Example 7. Would a DBMS designcd for use on a PC by a singlc user also have the same
components?
Such systems generally do not need facilities like concurrency control and logging and recover.
Such systems therefore can be significantly smaller than multi-user database systems.
Example 8. What are the responsibilities of a DBA?
Usually a person (or a group of persons) centrally located, with an overall view of the database,
is needed to keep the database running smoothly. Such a person is called the Database Administrator
(DBA)
34 DATABASE MANAGEMENT SYSTEM

The DBA would normally have a large number of tasks related to maintaining and managing
the database. These tasks would include the following:
• Deciding and Loading the Database Contents - The DBA in consultation with senior
management is normally responsible for defining the conceptual schema of the database. The DBA
would also be responsible for making changes to the conceptual schema of the database if and when
necessary.
• Assisting and Approving Applications and Access - The DBA would normally provide
assistance to end-users interested in writing application programs to access the database. The DBA
would also approve or disapprove access to the various parts of the database by different users.
,
• Backup and Recover - Since the database is such a valuable asset. the DBA must make all
the efforts possible to ensure that the asset is not damaged or lost. This normally requires a DBA to
ensure that regular backups of a database are c~rried out and in case of failure (or some other
disaster like fire or flood), suitable recovery procedures are used to bring the database up with as
little down time as possible.
Deciding Data Structures - Once the database contents have been decided, the DBA would
normally make decisions regarding how data is to be stored and what indexws need to be maintained.
In addition. a DBA normally monitors the performance of the DBMS and makes changes to data
structures if the performance justifies them. In some cases, radical changes to the data structures
may be called for.
• Monitor Actual Usage - The DBA monitors actual usage to ensure that policies laid down
regarding use of the database are being followed. The usage information is also used for performance
tuning.
Example 9. What is Database Analysis Life Cycle and explain clearly.
Data analysis is concerned with the NATURE and USE of data. It involves the identification of
the data elements which are needed to support the data processing system of the organization, the
placing of these elements into logical groups and the definition of the relationships between the
resulting groups.
Other approaches, e.g. D.F.Ds and Flowcharts, have been concerned with the flow of data-
dataflow methodologies. Data analysis is one of several data stmcture based methodologies Jackson
SP/D is another.
Systems analysts often. in practice, go directly from fact finding to implementation dependent
data analysis. Their assumptions about the usage of properties of and relationships between data
elements are embodied directly in record and file designs and computer procedure specifications.
The introduction of Database Management Systems (DBMS) has encouraged a higher or analysis,
where the data elements are defined by a logical model or 'schema' (conceptual schema). When
discussing the schema in the contact of a DBMS, the effects of alternative designs on the efficiency
DATABASE MANAGEMENT SYSTEM 35

or ease of implementation is considered, i.e. the analysis is still somewhat implementation dependent.
If we consider the data relationships, usages and properties that are important to the business without
regard to their representation in a particular computerised system using particular software, we
have what we are concerned with, implementationin dependent data analysis.
It is fair to ask why data analysis should be done if it is possible, in practice to go straight to a
computerised system design. Data analysis is time consuming; it throws up a lot of question.
Implementation may be slowed down while the answers are sought. It is more expedient to have an
experienced analyst' get on with the job' and come up with a design straight away. The main difference
is that data analysis is more likely to result in a design which meets both present and future
requirements, being more easily adapted to changes in the business or in the computing equipment.
It can also be argued that it tends to ensure that policy questions concerning the organisations data
are answered by the managers of the organisation, not by the systems analysts. Data analysis may
be thought of as the 'slow and careful' approach, whereas omitting this step is 'quick and dirty'.
From another viewpoint, data analysis provides useful insights for general design principals
which will benefit the trainee analyst even if he finally settles for a 'quick and dirty' solution.
The development of techniques of data analysis have helped to understand the structure and
meaning of data in organisations. Data analysis techniques can be used as the first step of extrapolating
the complexities of the real world into a model that can be held on a computer and be accessed by
many users. The data can be gathered by conventional methods such a interviewing people in the
organisation and studying documents. The facts can be represented as objects of interest. There are
a number of documentation tools available for data analysis, such as entityrelationship diagrams.
These are useful aids to communication, help to ensure that the work is carried out in a thorough
manner, and ease the mapping processes that follow data analysis. Some of the documents can be
used as source documents for the data dictionary.
In data analysis we analysis we analyse the data and build a systems representation in the form
of a data model (conceptual). A conceptual data model specifies, the structure of the data and the
processes which use that data.
Data Analysis =establishing the nature of data.
Functional Analysis =establishing the use of data.
However, since Data and Functional Analysis are so intermixed, we shall use the term Data
Analysis to cover both.
Building a model of an organisation is not easy. The whole organisation is too large as there will
be too many things to be modelled. It takes too long and does not achieve anything concrete like an
information system, and managers want tangible results fairly quickly. It is therefore the task of the
data analyst to model a particular view of the organisation, one which proves reasonable and accurate
for most applications and uses. Data has an intrinsic structure of its own, independent of processing,
reports formats etc. The data model seeks to make explicit that structure.
36 DATABASE MANAGEMENT SYSTEM

Data analysis was described as establishing the nature and use of data.

::'i Database study


~----------------~
I
Database design
I I

I Implementation and loading I~


'~i______________________~I •

Testing and evaluation

Operation

J Maintenance and Evolution j


L

Database Analysis Life Cycle

When a database designer is approaching the problem of constructing a database system. the
logical steps followed is that of the database analysis life-cycle:
• Database study -- Here the designer creates a written specification in words for the database
system to be buIlt. This involves:
• analY!'>ing the company situation -- is it an expanding company. dynamic in its requirements.
mature in nature, solid background in employee training for new internal products. etc.
The~e have an impact on how the specification is to be viewed .

• define problems and constrainb -- What i!'> the situation currently? How does the company
deal with the rask which the new database i-; to perform. Any issues around the current
method? What are the limits of the new system?
• define objectives -- What is the new database system going to have to do, and in what way
must it be done. What information does the company wanl to store specifically. and what
doe~ it want to calculate. How will the data evolve.

• detine scope and boundaries -- What is stored on this new database :-ystem, and what it
DATABASE MANAGEMENT SYSTEM 37

stored elsewhere. Will it interface, to another database?


• Database Design - Conceptual, logical, and physical design steps in taking specifications to
phy<;ical implementable designs. This is looked at more closely in a moment.
• Implementation and loading - It is quite possible that the database is to run on a machine
which as yet does not have a database management system running on it at the moment. If this is the
case one must be installed on that machine. Once a DBMS has been installed, the database itself
must be created within the DBMS. Finally, not all database itself must loaded with the initial data
set (slich as the current inventory. current staff names, current customer details, etc.).
• Testing and evaluation - The database, once implemented. must be tested against the
specificating supplied by the client. It is also useful to test the database with the client using mock
data. as clients do not always have a full understanding of what they have actually asked for! In
addition. this step in the life cycle offers the chance to the designer to fune-tune the system for best
performance. Finally, it is a good idea to evaluate the database in-situ. along with any linked
appl ication.
• Operation - This step is where the system is actually in real usage by the company.
• Maintenance and evolution - Designers rarely get everything perfect first time, and it may
be the case that the company requests changes to fix problems with the system or to recommend
enhancements or new requirements .
• Commonly development takes place without change to the database structure. In elderly systems
the DB structure becomes fossilized.
Example 10. What is Three-Level Database Model and explain clearly.
Often referred to as the three-level model. this is where the design moves from a written
specification taken from the real-world requirements to a physically-implementable design for a
specific DBMS. The three levels commonly referred to are 'Conceptual Design', 'Data Model
Mapping'. and 'Physical Design'.
The specification is usually in the form of written document containing customer requirements,
mock reports, screen drawings and the like. written by the client to indicate the requirements which
the final system is to have. Often s.uch data has to be collected together from a variety of internal
sources to the company and then analysed to see if the requirements are necessary, correct and
efficient.
Once the Database requirements have been collated. the conceptual Design phase takes the
requirements and produces a high-level data model of the database structure. In this module, we
use ER modelling to represent high-level data models. but there are other techniques. This model is
independent of the final DBMS which the database will be installed in.
38 DATABASE MANAGEMENT SYSTEM

Mini-World View

Requirements Collection
and Analysis

•~
Ilii9iiiMM'*

J
I Conceptual Design J~
~;m

•. 1 I
.. I Data Model Mapping
I '*'ASdSVSN UU
I~ U
I Physical Design I~

~~
Logic behind the three level architecture

Next. the Conceptual Design phase takes the high-level date model it taken and converted into
a converted into a conceptual schema. which is specific to a particular DBMS class (e.g. relational).
For a relational system, such as Oracle, an appropriate conceptual schema would be relations.
Finally in the Physical Design phase the conceptual schema is converted into database internal
structures. This is specific to a particular DBMS product.
Example 11. Write Short Note following:
• Basics
• Entities
• Attnbutes
• Keys
• Relationships
• Degree of a Relationship
• Replacing ternary relationships
• Cardinality
• Optionality
• Entity Sets
• Contirming Correctness
DATABASE MANAGEMENT SYSTEM 39

• Deriving the relationship parameters


• Redundant relationships example
• Splitting n:m Relationships
• Splitting n:m Relationships - Example
• Constructing an ER model

Basics
Entity Relationship (ER) modelling
• i~ a design tool
• is a graphical representation of the database system
• provides a high-level conceptual data model
• supports the user'!> perception of the data
• IS DBMS and hardware independent
• had many variants
• IS composed of entities. attribute5.. and relationships

Entities
• An entIty is any object In the system that we want to model and store information about.
• Individual objects are called entities.
• Grouplo. of the same type of objects are called entity lypes or entity sets .
.. Entities are represented by rectangles (either with round or square corners)

Lecturer
'---------'
1----------11 Lecturer
Chen's notation Other notations

Entities

• There are two types of entities, week and strong entity types.

Attribute
• All the date relating to an entity is held in its attributes.
• An attribute is a property of an entity.
• Each attnbute can have any value from its domain.
• Each entity \\I ithin an entity type.
40 DATABASE MANAGEMENT SYSTEM

·Many have any number of attributes.


• Can have different attribute values than that in any other entity .
• Have the same number of attributes.
• Attribute~ can be.
• Simple or composite.
• Single-valued or multi-valued.
• Attributes can be shown on ER models.
• They appear inside ovals and are attached to their entity.
• Note that entity types can have a large number of attributes. If all are shown then the diagrams
would be confusing. Only show an attribute if it adds information to ER diagram. or clarifies a
point.

Lecturer

Attributes

Keys
• A key is a data item that allows us to uniquely identify individual occurrences or an entity
type.
• A candidate key is an attribute or set of attributes that uoiqusly identifies individual occurrences
or an entity type.
• An entity type may have one or more possible candidate keys, the one which is selected is
known as the primary key.

• A composite key is a candidate key that consists of two or more attributes .


• The name of each primary key attribute is underlined.

Relationships
• A relationship type is a meaningful association between entity types.
• A relationship is an association of entities where the association includes one entity from each
participating entity type.
• Relationship types are represented on the ER diagram by a series of lines.
• As always, there are many notations in use today ...
DATABASE MANAGEMENT SYSTEM 41

·In the original Chen notation. the relationship is placed inside a diamond. e.g. managers manage
employees:

Chens notation for relationships

• For this module. we will use an alternative notation. where the relationship is it label on the
line. The meaning: is identical.

I Manager I manages IEmployee I


Relationship used in tllis Document

Degree of a Relationship
• The number of participating entities in a relationship i~ known as the degree of the relationship.
• If there are two entity types involved it is a binary relationship type

I Manager 1~ ______ m_a_n_a_g_e_S_ _ _ _ _ --;1 Employee I


Binary Relationships

• If there are three entity types involved it is a ternary relationship type.

Sales Assistant ~_ _ _ _ _S_er-"_s______--i

Ternary relationship

• It is possible to have a n-ary relationship (e.g. quaternary or unary).


• Unary relationships are also known as a recllrsive relationship.

I
. - -_ _ _ _.0.--, manages

Employee

Recursive relationships

• It is a relationship where the same entity participates more than once in different roles.
• In the example above we are saying that employees are managed by employees.
42 DATABASE MANAGEMENT SYSTEM

• If we wanted more information about who manages whom. we could introduce a second entity
type called manager.

Degree of a Relationship
• It is also possible to have entities associated through two or more distinct relationship.
manages
Department Employee
employs

Multiple relationships

• In the representation we use it is not possible to have attributes as part of a relationship. To


support this other entity types need to be developed.

Replacing ternary relationships


When ternary relationship occurs in an ER model they should always be removed before finishing
the model. Sometimes the relationships can be replaced by a series of binary relationships that link
pairs of the original ternary relationship.
sells

Customer

A ternary relationship example

• This can result in the loss of some information - It is no longer clear which sales assistant
sold a customer a particular product.
• Try replacing the ternary relationship with an entity type and a set of binary relationships.
Relationships are lIsually verbs, so name the new entity type by the relationship verb rewritten
as a noun.
• The relationship sells can become the entity type sale.

Sales Assistant 1 - - - - - - - 1
makes Involves

ICustomer I
Replacing a ternary relationship
DATABASE MANAGEMENT SYSTEM 43

• So a sales assistant can be linked to a specific customer and both of them to the sale of
particular product.
• This process also work for higher order relationships.
Cardinality
• Relationships are rarely one-to-one.
• For example. a manager usually manages more than one employee.
• This is described by the cardinality of the relationship, for which there are four possible
categories.
• One to one ( I: 1) relationship.
• One to many (1 :m) relationship.
• Many to one (m: I) relationship.
• Many to many (m:n) relationship.
• On an ER diagram. if the end of a relationship is straight. it represents I. while a "crow's foot"
and represents many.
• A one to one relationship - A man can only marry one woman and a woman can only marry
one man, so it is a one to one (1 : I) relationship.

is married to
Man Woman

One to One relationship example -

• A one to may relationship - One manager manages many employees, but each employee
only has one manager, so it is a one to many (I : n) relationship.
IManager II-______m_a_n_a~g_es_ _ _ _ _ __II Employee I
One to Many relationship example

• A many to one relationship - Many students study one course. They do not study more than
one course. so it is a may to one (m : 1) relationship.
studies
Student Course

Many to One relationship example

• A many to many relationship - One lecturer teaches many students and a student is taught by
many lecturers, so it is a many to many (m : n) relationship.
Random documents with unrelated
content Scribd suggests to you:
人命。擬此兇惡,殆猛獸中之窮奇,蟄蟲中之虺也。贓證俱真,合擬
大辟,餘黨再獲究。

鄒御史德化群盜
萬曆貴州年饑,百姓逃亡者多,有等負血氣者,相聚為盜。劫掠鄉
村,殺擄人民。打州搶縣,帑藏一空,官司莫敢誰何。所在有司公文
告急,兵部急馳本奏知朝廷,聖旨著吏部知道。吏部奏曰:「貴州反
蠻地方,未知聖化,若是加兵征剿,恐急迫投入蠻夷,為禍不小。須
得一良臣,撫蒞慰彼。赤子無知,一時為饑荒所迫,相聚為非,倘能
改正,即我良民。此以德服人,堯舜之道也。」皇帝准奏,即著吏部
推擢智能之士。
時鄒元標為縣令,任滿回朝復命。吏部議曰:「貴州之亂非鄒公不
可。」於是擢為貴州道御史。百姓聞知,無不歡悅,皆言:「鄒老爺
若來,我等即見太平矣。」鄒公到任,巡撫各府縣,吏胥奉法,百姓
安堵。
一日,於察院會同三司,商議弭盜安民之策。眾論紛紛不一,於是
有欲鄒用相者察得其盜,用厚賂以解散之也。有以趙廣漢鉤鉅之術進
者,廣漢用智,門外置一鉤鉅,使人投匿其中,有群盜聚空舍,謀欲
劫人。商榷未畢,即為漢所捕獲。為此策者,欲鄒密知賊情出沒而用
奇兵殲之也。一謀士曰:「察見淵魚者不祥,智料隱匿者有殃,如二
公所談均未得其本也。戴淵與樑上君子獨非劫客耶?一指揮江上而為
陸學士所化,一隱伏梁間而為陳太丘所新。彼二公者,非用伺察,非
用鉤距也。惡非本來,善乃真性,彼惟從其真者覺悟之,故盜自知愧
也。又漢龔遂為渤海太守,宣帝召見問以息盜之術。遂答曰﹔『海瀕
遐遠,不沾聖化。民困於饑寒而吏莫之恤,故使陛下赤子弄兵於潢池
中耳。臣聞:「治亂民猶治亂繩,不可急也。」願丞相御史無拘,臣
以文法,俾臣得一切便宜從事。,宣帝許之。遂乘傳之渤海界,移檄
郡縣,罷捕盜之令。且對眾曰:『凡持田器者皆良民,持兵刃者皆亂
民。』群盜聞之,悉皆棄兵弩而執鉤,盜俱平服。公請擇於斯二
者。」鄒曰:「弭盜惟有兩端,非德化則威制也。」又曰:「心服為
上,力屈次之。某雖不才,願從事先生教益。」
鄒後巡撫至彼,使者旁午於道。有以負固不服告者﹔有以遠交近攻
告者﹔以訓練士卒,積聚芻糧,將兵欲戰告者﹔有以賊勢不振,烏屯
蟻聚之眾,解散一半告者﹔幕下將官有欲整大軍直搗其巢穴者﹔有欲
挑戰祥比,出奇兵以勝之者﹔有欲流言反間,欲使彼自相殺戮,乘亂
以攻之者﹔有欲修書厚賂,買結某處,兩路約訂同日起兵,使彼三面
受敵,首尾不能救應者。鄒不為惑,惟給榜文四方張掛,許彼改惡從
善。既捕獲真賊,喚至案前。先偷以良心真性,次曉以順逆禍福,終
給以衣服、酒食,令之自去。向化而為善,於是群盜聞風感激,漸次
解散。
一日,細作來說賊巢尚有數寨,感公撫恤之仁,思欲效順納款。恐
公不以為誠,故未敢即至。一謀士密白鄒曰:「暗檄令送薪芻,試其
向化俟。至轅門,伏甲誅之,可獲首級,以充軍功。」鄒曰:「殺降
不祥,且傷皇上好生之德。公策雖善,某不敢用也。」由是群盜聞
之,悉皆泣涕投劍。鄒承命捕盜,不糜費糧食,不肝腦百姓,而貴州
靜治。
盜惡原非性本來,逃亡空匱聚蚊雷。
一聞御史傷主語,泣血相看擲劍回。

陳風憲判謀布客
陳選,字士賢,天臺臨海人。髮髫齠時,即立志以古聖賢自期待。
奉身甚約,操履甚端。登黃甲,每居一官,必欲盡職﹔每行一事,必
欲盡心。視去就為其輕,惟屬意於生靈國脈,名重海內。士大夫無問
識與不識,論一時正人,必僉曰:「陳選。」
司風憲時,方諏日戒道啟行,已至所轄屬地。尚未到任,道間忽有
數百蠅蚋飛迎馬首,撲之不去。選曰:「我自履歷宦途,左右非濟濟
縉紳,則前後師師甲冑。況風憲官奉皇帝出巡,山嶽震動。過州州
接,過縣縣迎。今擁集馬首者非眾多百姓,非眾多父老官吏,乃逐墜
蠅蚋如此。曾聞諺語云:『鵲為喜報,鴉為凶鳴。』此屬之來,即不
占吉凶,定不徒也。間閱《包龍圖公案》,曾有蠅蚋迎馬首之事,今
日或亦其故轍未可知也。昔龍圖發奸摘伏青史標明,今日果有此事,
亦當媲美前修。」遂命左右跟尋蠅蚋所止去處。蠅蚋微物,若有知
識,聞選吩咐左右跟尋之言,數百振羽一飛,有若風響,集於一深山
墳上。此山村木茂密,藏有蛇蠍,人所罕入。左右跟尋得實回報。
陳即駐帷於地方古寺,隨命地方里老同公差往山掘之,見一客人屍
首。人死未久,肉色尚新。搜驗身傍,得一木雕小印。選思曰:「此
必布客被人所謀。」著令地方具棺埋葬,餘無半言吩咐。縣官耳聞是
事,兼是己所治地,心下不安。拘問曰:「地方關係甚大,朝廷設立
保長、保甲諸色員役,非直保固比閭族黨,亦將保固遠來行旅。今汝
等縱賊謀人,瓜分銀貨,罪將安釋?今且容汝數日,須訊問客人何方
人氏,探訪賊人名姓、真贓方贖得你等罪。不然,定是你地方謀劫。
陳爺生殺衙門,見其事而不言,則怒可知已,此事卻是擔干係。」地
方聞縣主言,驚得魂不附體,俱應允探訪回報。自後諸人互相覺察,
東呈西首,鼠竊狗偷,捕捉殆盡,填滿縣監。縣主繫心此事,恐陳見
罪,將地方所呈首人犯,嚴刑拷鞫。有富家子弟,因言氣被誣者,受
刑不過,冒認供招是己謀劫,妄扳某人知情,某人主令,某人下手,
某人埋葬,某人得貨,某人得銀,飄空牽連數十人。主令:「下手俱
問死罪,知情、分贓俱擬重辟,其餘照律減等。」縣主只說是真,喜
為己功﹔地方以為得實,喜豁己罪。只未具文申報。
且說陳公登任,屬官如蟻,恭遏諸務未遑,即吩咐云:「奉朝廷新
例,欲市上好綿布千疋,三日內要取齊。即去鋪行討行揀選,但布上
要記各人名字,以便領價。」屬官不知此是賺賊之計,只說是真要綿
布解京,即討來布若干,以憑揀選。陳云:「布不論精粗,只要有印
記者,即取來看印記,又要與小木印記同者方許入選,餘即發還。」
查有同小木印記者,即照名喚入,究問來歷。布行云:「布從張成牙
家轉販來賣。」又照名拘一布行來問,所對亦同。遂拘布牙來問,牙
人云:「日前有吉水縣客人名柯盛,帶布若干,投店發賣。今布已盡
賣,人已回去。本牙無復存有半匹此布。」陳云:「此非布客,乃劫
布之賊,日前在某處謀了一布客。想汝知情,故把在此處發賣。今且
不打你,與你公文一角,捕兵二名,星夜往吉安縣投發。有此劫賊還
我,脫得你罪﹔若拿不得此人,定坐你填命。」牙人云:「做經紀往
過來續,只說他是某方客人,不知他是劫布之賊。今老爺著小人領公
文,同捕兵前去吉安縣捕捉,只恐賊人假報地方姓名,則彼地倘無此
人,叫小人如何回報?」陳云:「汝第去此,客謀死未久,此賊去亦
不遠。倘天理不容,冤魂不散,汝去必捉獲得來。我亦知汝不知情,
我亦知賊人假報地方姓名。而必欲汝去者,正欲得其真耳。」
牙人只得領了公文,同捕兵逕往吉安縣投發,縣官開折看時,書數
行大字,云:「仰吉安縣知縣,速將謀劫布客賊人柯盛捕緝,解審無
違。」縣主云:「數日之前,地方呈一起事云,剪賊安民詞內云,土
賊鄭島梗路荊蓁,前月初七日謀劫布客曾良,得銀回家。宿娼撒潑,
禍亂地方。我已捕捉,監禁未問,想莫就是此人?」據來文姓名,又
與此不同。問牙人云:「汝既代他做牙,必識認其人,汝可往禁中看
此人是否。如不是,我即行牌差人去拿。」隨命皂隸領牙人入監探其
的實。牙人行至監外一望,果見前日是此人。賣布其人亦認得是牙
人,亦從監門邊相見,詢問經紀到此貴幹。牙人紿之云:「為親戚有
些小事告在貴縣,聞監禁在此,故來相看。不意老丈為何事亦拘繫在
此?」賊對曰:「為人所誣耳。」牙人曰:「容再來相看。」即回稟
縣主云:「監中之人,即前日投我賣布之人,適到監門,我未開口,
他即問我。賊人計較盡多,在我那裡懸空報個假姓名,老爺這裡又是
一個姓名。若不是老爺有見,小人今番又落空了。但上司公文緊急,
老爺這裡須將賊人肘鐐鎖扭,差人解往上司審問,亦見老爺捉賊有
功。」縣主云:「這個是我的事。」即具文將賊人肘鐐鎖扭,差捕兵
數名同原差、牙人一同解去。
適本縣亦將地方首舉問擬一干人犯解來,陳風憲正開門投文,即見
吉安縣公差並捕兵、牙人解得有劫布真賊到,又有本縣公差解得有一
干呈舉謀命賊犯到。怒上心來,即喚皂隸,且將牙人認出真賊重打四
十迎風。單將吉安縣公文拆閱,見賊人先已監禁縣中。捕兵、牙人又
將宿娼撒潑地方呈首事情說了一番。陳見其人真事真,只姓名假報不
真,謂牙人云:「大凡良善百姓,再不假報姓名。惟賊人恐怕識破,
故有許多姓名誑人。汝未行先有此慮,果如所料。」且問賊人:「布
是何方客人的,汝同何人下手殺他,一一從直供來。據縣中申來地方
呈詞,汝為梗路荊蓁,不知汝謀了許多客人,今日罪惡貫盈,故我得
聞出其事。」賊人推托不認。陳命再打三十,打了又挾又榔,身無全
膚。抵刑不過,只得招認:「前月初二日,布客一人,自挑綿布一
擔,日中時分,打從地方東嶺深林經過。某不合見財起心,打聽前後
無人,手執生柴,望客人腦頂一棍。客人氣絕,拖至茂林深處埋掩。
挑布回家,哄瞞鄰里,只說是自己買來。越三日,挑至本縣牙人家發
賣,鄰里、牙人並不知情事。恐漏機,故懸空報個姓名,欺瞞經紀,
逃脫禍胎。不虞天理難欺,人難輕殺,臺輿有蠅蚋之迎,縣主有地主
之首。地方所呈首者,歷歷非真﹔縣主所問擬者,人人非實。我殺人
而官殺我,報應甚嚴﹔我劫布而官追布,去來甚速。自甘殞首以填,
聽從法司而處決。」陳見供招得實,遂擬死辟。吉安知縣,旌其癉惡
得宜﹔本縣知縣,罰其容奸太過,責罰地方,釋醒誣妄。
陳爺判云:
審得賊人鄭島,心同蛇蠍,惡甚虎狼。猛獸深藏,盡好乘機伺便﹔
布商孤至,不虞驅阱投牢。生棍劈頭,七魄三魂何處去﹔假言欺眾,
千辛萬苦買將來。蠅蚋報出屍骸,木印認出贓證。此布匹給還被害之
家,彼囚犯知是妄招之枉。經紀本不知情,縣主失於不謹。梟其人
首,罰一以警其餘﹔釋諸人罪,取新而革其舊。
自後賊風屏息,人人稱為陳皓月。
辛苦經商為甚由,區區胤冑立箕裘。
不虞布帛能亡命,剩得深林土一 。

天設爐錘待汝曹,惡人添淚酷焦熬。
深林不是天遺漏,馬首迎蠅報禍苗。

陳縣尹判盜官帑
陳襄,字述古,候官縣人,以經學登進士第。初授福建浦城縣尹,
才智過人。縣中凡百隱伏事情,莫能逃其洞燭。官雖廉明,遺奸不能
盡革。不意縣帑一日失金,襄曰:「楚庫失銀,楚人盜之﹔縣帑失
金,又豈他人?必縣中慣為盜者。」乃悉捕平昔為盜者鞫之。盜至階
下,各爭辯莫得其實。襄曰:「此輩難以威劫,可以術籠。」思之良
久,有悟於心。次日,呼群盜至堂下,因紿之曰:「聞關王廟有一
鐘,歷世多年,今已成神,最能辨盜。我今鞫汝諸人,汝諸人死爭,
謂內帑之金非汝等所盜。與其憑意見決之於己,不若決之於神,使汝
等莫能遁。昨已使人迎鐘至縣堂後閣,祀之。靜夜焚香,禱求再四,
欲聰明正直之神考察精詳,勿令濫及無辜也。今喚汝等立於鐘前,不
衰誠敬。再率同僚為汝禱之,祝曰:『人間私語,天聞若雷﹔暗室虧
心,神目如電。維汝鐘神享吾祭祀,顯其精英,決民皂白。縣帑失金
何人所盜,靈驗不差,符予所望。』」禱畢,又謂群盜曰:「此鐘極
是靈驗有準,汝第以手試之,不為盜者摸之,則無聲﹔為盜者摸之,
則有聲。頃刻真偽攸分,再難爭辯。」又陰使人先以墨汁塗抹鐘內,
隨引群盜人內閣,令各以手摸之,摸畢出驗其手。惟一囚手上無墨。
諸囚不知本官此是籠絡之術,在墨跡上辨盜,不在鐘聲上辨盜。
遂單取無墨跡之囚,問曰:「縣帑之金分明是汝盜去,不為盜者心
無所懼,信手去摸,不計聲之有無,則有墨。汝犯真心怯,惟恐摸響
其鐘,故輕輕去摸,手無墨跡。汝從直招來,免汝笞責。若不供認,
重刑不貸。」其囚情知是實,遂逐一招認:「數日前晚時刻,潛入帑
內,盜出庫金是的。現今用去數兩,餘者俱在,與眾囚並無相干。」
襄得其實,隨命民快等鎖押盜金之囚至家,追取存留銀兩。用去者責
令賣產賠償,照贓擬罪。餘囚俱行釋放。一郡帖服,俱稱為活神仙,
自後城中無盜。
劫賊如何劫庫金,法門侮法禍尤森。
摸鐘賺出為真盜,狐鼠聞風莫置身。

賈縣尹判吏竊庫
賈郁性峭直,不容人過,官拜仙游縣知縣。尊賢育士,獎善鋤強,
百姓戴之。歌曰:「心地芝蘭茂,性天麟鳳生。花村無犬吠,綠野有
人耕。」蓋美其善政之得民也。三年任滿,將給由過京。縣中諸吏胥
各兢兢奉法,不以郁之去留為敬肆。惟一吏黃采不遵約束,酗酒撒
潑。郁怒曰:「吾別調則已,若再典是邑,必懲此曹。」吏以其去,
大聲應曰:「公欲再來,猶造鐵船渡海也。」人有為醉吏危,曰:
「汝失言矣。人生行藏靡定,往返無常。萬一賈爺復來,汝罪奚
逭?」吏曰:「吾所為是言者,是或一見也。本官政聲籍籍,此去銓
曹課績,若考上上則京,擢考中上則遠補,考下上則他任,必無再典
是邑之理。鐵船渡海,夫豈失言?」
後朝廷以郁有吏才,居仙游三年,政清訟簡,物阜民熙。欲其久任
成功,乃加俸敕。郁復仙游時,醉吏以郁去莫奈己何,一發放縱。乃
用錢夤緣署印官,轉為架閣庫吏。妄作妄為,視庫藏如私帑,輕錢穀
若鴻毛。身役公門,心耽花酒。日支月費,挪移借辦,盜竊不貲矣。
人有為之聯曰:「仙游士庶屬賢候,去一日則思慕一日﹔架閣金銀歸
醉吏,進半時則盜竊半時。」又一聯曰:「羊質署印官﹔虎皮司庫
吏。」蓋揚其過也。
一日,朝報賈郁奉敕復典仙游,期限本月,念一日馳驛之任。醉吏
聞報驚駭,措躬無地。諺云:「懼法朝朝樂,欺公日日憂。」此時此
勢,孽已作了,慾已縱了,事已過了,家筵消乏,用去庫藏莫能補
足。親友以其亡賴,莫肯貸借。況先時已有鐵船渡海之言,忤觸本
官,今又盜竊庫藏,難逃法網。逡巡遷延,心下錯愕無定。及郁復
任,見醉吏心雖芥蒂,前言外貌,則待之如故,以其能改即止也。
一日,鄰府推官奉欽差巡按監察御史,委查盤該府各縣倉庫錢糧。
府發,牌下,縣令庫書速造下馬查盤冊。庫書見牌到,催醉吏辦銀補
庫,庫吏酣醉日多,何處得銀補數。庫書恐事發累己,只得照支票開
出實收,具詞呈聞於郁。郁閱詞大駭,謂庫書曰:「庫藏乃生民膏
脂,朝廷命脈。一人恣雎其間,乃王法所不貸者。想汝通同作弊,利
則歸己,禍則歸人。」庫書曰:「有支票現在,小人畏法,分毫不敢
妄覬,拘吏面鞫,便知虛實。」郁乃逮吏考鞫,醉吏犯真,乃一一招
認,不敢扳扯庫書。自情願鬻妻賣產補償其庫。
賈尹批云:
竊銅錢以潤家,非因鑄器﹔造鐵船而渡海,不假爐錘。合杖一百,
擬徒三年。
醉吏顛刑只犯刑,鐵船莫載罪餘盈。
廉官復典仙游事,此屬頑冥法必懲。

第四卷 雪冤類
陸尚書判釋大逆
陸瑜,浙江鄞縣人,久居法曹,為刑部屬官十餘年,有清廉聲。至
是為刑部尚書,明於法令,練習國家典故,屢辦冤獄,人咸德之。時
弘農衛卒汪祿,誣訴指揮李彬潛謀不軌,事有徵驗。主上見疏大怒,
頒聖上旨,著落錦衣衛指揮門達鞫之。時達新家眷,汪博寵作威,飾
虛成實。惡李彬素有言觸己,至是自罹於法,得以泄已私忿。不借一
言開豁,更為羅織鍛鍊。云:「李彬反形已具,衛卒所訴不誣。」方
欲具文申詳通政司監候請旨,坐李彬以族誅之慘。
適刑部尚書陸瑜奉旨會審其事,瑜公審鞫,知其事始為衛卒所誣,
次為問官所枉,見上獨白其冤枉,欲行一條方便路也。門達惡瑜不附
己,翻駁己,問成前案,不勝忿怒。在上前以語侵瑜,且劾瑜私受李
彬賄賂,而出其反罪。瑜在上前從容辯曰:「法司所執者,祖宗三尺
之法。倘其人罪真,吾不敢置之生議﹔倘其人罪枉,吾不敢附之死
條。李彬反形無驗,況明律謀反者族,吾何敢枉人以滅族之罪?」上
竟從瑜議,止罪李彬不及其妻子。人皆稱其為忠厚長者。
哆侈虛張剌小人,獄人族禍獨何心。
從容御座明冤枉,不畏奸諛以語侵。

王御史判奸成婚
龍溪縣高文元出宦於外,其女高愉妹年登十七,國色傾城,秉性超
俗,既精女工,尤耽詩賦。時三月春殘,韶光明媚。閨坐無聊,有思
春厭悶之意。與侍婢貢名香入游後門花園,見千紅萬紫,竟秀爭芳﹔
浮水鴛鴦對對,噪林鳥鵲雙雙。益想起春光易老,人生少年難再,何
時得遂夫婦之樂,少酬素願也。因見落花滿地,遂朗吟一絕,云:
「洞府有人春寂寞,年年無語鎖天臺。桃花已遣隨流去,懊恨劉郎猶
未來。」細語嬌聲,猶勝新鶯巧唱,藻詞秀韻,還過豔蕊初開。
吟詠之餘,適牆外有徐守恂者,年方十八,徐卿官之幼子也。人品
超群,聰明蓋世。父母欲令其進學,方為議親。春心撩亂,因獨步閒
遊。陡聞牆內吟詠詩句,字字清明,聲聲嘹亮,知是閨女傷春而遣興
也。亦吟一絕挑之,云:「欲到天臺路已迷,徘徊花外聽鶯啼。劉郎
有意尋芳久,借問仙娥許我期。」高小姐在牆內聞之,其音清、其詞
麗,心已羨服。自思曰:「我思春心事,不意被此人瞧破。只此人亦
是有才識者,便以詩自媒於我,凡百男女風月之情則一也。」乃探首
外窺,見徐公子丰儀清雅,美貌動人,心中已十分可意。徐生在外看
見高小姐如嫦娥出月宮,非人世所有也,即仰謂之曰:「聞名園好花
好景,斗膽借一遊玩何如?」高氏已會得前詩中意,又愛徐生才貌,
即許之曰:「公子暫停,吾取鎖鑰來,開後門請進。」回步哄名香
曰:「怯才出來,未鎖房門,你可歸看之。吾少刻自歸,不必來
候。」
名香去後,即復來開後門。徐生欣然進門,唱禮後,便問曰:「此
門未有鎖,何故云取鑰來開?」高氏曰:「非取鑰匙也,適使女名香
在此伴我,吾哄之先歸耳。」徐生知高氏有心私他,心中暗喜。略與
玩花片時,羨曰:「貴園群芳聳翠,百卉爭妍。真天臺仙境,恐月宮
只一樹仙桂,尚不及此也。」高氏曰:「小園幽僻不堪,公子勝游,
何敢當此延譽。」徐生問曰:「前是何亭?必有景致可玩也,幸指引
之。」高氏曰:「前即牡丹亭,好花都羅列於亭前,吾引公子玩
之。」徐生隨行,見亭前果環植奇花,裝排勝景,大快人心目。
亭中淨几繡座,色色珍異。亭左另一燕居,小巧奇絕。中有牙?繡
枕,乃倦游而憩息之所也。徐生心思此地甚好投機矣,便懇求曰:
「蒙小姐垂愛,得入仙宮。若不插枝花以歸,亭外百花也笑人。願得
陽臺一會,百歲銘心。」高氏曰:「與公子締好,亦芝蘭同味,但閨
女犯此,恐玷物議。」徐生曰:「外人不知,何以招議?即有知者,
昔張生於鶯鶯、辜輅於瑜娘,皆在室先通後為夫婦,至今傳作美談。
吾與汝皆未婚娶,今日事若有人知,父母必當自為婉轉,遣媒成婚,
豈不更妙乎?」高氏見說知奸則父母必為結親,此話可信,因不推
辯。徐生遂為之解玉扣,脫繡襦。高氏半推半就,半喜半羞。只見溫
玉生香,春意滿懷。羅幃中攜雲握雨,錦衾下倒鳳顛鸞。氏如嫩蕊海
棠新著雨,生如嬌嘶渴馬奔清泉。煞多情,渾身通泰﹔忒有趣,兩意
和諧。花謝春猶在,戰酣興正濃。及雲收雨散,雙雙相攜而起。高氏
曰:「妾以千金之軀托於公子,不知何日得為夫婦也?」徐生曰:
「人有善願,天必從之。」留戀已久,日已近午,名香復來催食午。
此時徐生欲去而不忍去,高氏不留而意欲留,兩情難割。徐生曰:
「我明日復來,幸勿見拒。」高氏曰:「一日有情,終身難捨,何忍
再拒?」由是,徐生懶去向書館,日來園外。高氏懶去拈針線,日往
園中。私下偷情,如膠如蜜。往來月餘,人並不知。
一日,高氏之叔高從正,剛直人也,偶來園中,見牡丹亭畔燕居中
有男女笑語之聲,不知是誰,乃退立於荼架後。少頃,見女姪與徐生
攜手而出,送別後門,而後歸。從正方知女姪與徐生私通也,出言於
嫂嫂。曰:「豈有是乎?」從正曰:「明日可親捕之。」及次日,高
氏又往後園開門,延徐生而人,逕至燕居中敘情。從正同嫂入捕時,
已閉戶在?交媾,方敘興中之言。徐生曰:「你味何如?」高氏曰:
「如含一粒仙丹,遍體爽快,妙不可言。然則公子興味何如?」徐生
曰:「如入九天仙洞,吸瓊漿玉露,甘人肺腑,渾忘身世也。」從正
聽之,咬牙睜目﹔嫂氏便闇然失色。二人轉步外候。
一霎時後,徐生、高氏方笑謔開門,高氏見母與叔變臉外立,即掩
面跑歸。從正扭住徐生,劈面便打兩拳,問曰:「你在此何干!要偷
我園中珍玩麼?今日你願生願死?」徐生曰:「只願送官。」從正
曰:「你道不敢將你送官麼?」即扭出鎖住,解往漳州府,告於大
巡,曰:
狀告為強姦室女事,淫徒徐守恂,倚父勢宦,縱淫無忌,窺從正女
姪高氏獨立後園,惡即躍牆竄入,進前逼奸。女姪躲入牡丹亭,惡復
趕入強抱,喊聲聞外。從正同嫂入見,當場捉獲,縛送天臺。乞依法
正罪,掃清淫惡。救正風俗。
上告時,探花王剛中出為御史,巡按福建。以徐、高二家皆閥閱名
家,親提問之,曰:「你亦宦家子弟,當知禮義。何為強姦人室女,
辱玷祖宗?當問死罪矣。」徐守恂曰:「宦家後園牆高數仞,不是他
女姪開門,延納小的,何以飛人?姦情不敢隱,但和姦非強也。可憐
士夫女妻並未婚娶,若打死杖下,不如放生,望老爺垂仁超度。」王
御史問高氏曰:「和姦是真,必非強也?」高氏曰:「一時之錯不可
返,白圭之玷不可磨。望天恩曲庇,澤及閨幃,死不忘德。」王御史
曰:「汝兩下都認和姦,可先供狀,然後擬罪。」徐生、高氏各援筆
而成供狀,詞皆四六,贍博富麗。王御史見其供出成奸之由,起於詠
詩句。而所供之狀,果有才學。乃曰:「汝能為詩乎?此簷前有蛛網
懸蝶,試面賦之。」徐生吟曰:「只因賦性太顛狂,游遍花間覓遍
香。今日誤投羅網裡,轉身便是探花郎。」王公悅,又指竹簾謂女
曰:「汝試賦之。」高氏遂吟云:「綠筠劈破條條直,紅線經開眼眼
奇。只為愛花成片瑕,致令直節有參差。」王公憐二人之才,見其供
稱俱未議婚,乃謂之曰:「據律則通姦者該各杖八十,姑念汝天生一
對,才貌兩全。古云『君子樂成人之美』,當權正好行方便。吾何惜
一屈法,不以成人美乎?可令你結成姻緣,宜室宜家,是亦一大方便
也。」王公援筆判曰:
佳人才子兩相宜,致福端由禍所基。
永作夫妻諧老願,不勞鑽穴隙相窺。
高從正執曰:「如此則律何以禁?且非禮成婚,何以為訓也?」王
公曰:「豈不聞卓茂云:『律設大法,禮順人情。』又程子云:『王
道之大本乎人情。』則苟順於情即合禮合道,何奸於律?」由是,從
正不敢再執。各放之寧家,徐生高氏遂為夫婦。時人因號御史為「王
方便」。
按:判奸成婚本不合律,但以文士才女各未婚娶,愛惜其才,判之
成婚。一時人情不以為非,可見善持法者在變通從宜,不必膠柱鼓瑟
也。故記之以為欽恤者訓。

詹縣令判合幼婚
南海縣富民蘇紹軾,生女蘇麗卿,年已及笄,容貌甚美,兼通文
翰。同里人林秉謙托媒聘為長男婦,既而長男死,又央媒去議求出
親,與次男達常。少女長三歲,紹軾亦許之。及次年十月于歸,蘇氏
十六歲,身材壯大﹔而達常方十三歲,軀幹微小。尚未知咸琩ヾQ蘇
氏早已知春意。以夫君幼弱,心甚不悅。當為春怨一絕,云:「天桃
含蕊欲開華,恨殺春風未破他。何得陽和敷德澤,少滋些雨助嬌
花。」又其年十二月,夫之堂兄亦完親,尚後蘇氏兩個月,及期年而
生一男,請宗族諸婦飲喜酒。蘇氏自思:「我先人林門,以夫幼並未
得沾雨露。彼後我成親,得丈夫長大,今遂生男。」因忿恨,不赴
席。生子家強來請之,蘇氏寄詩辭之曰:「去年臘月迎新婦,今日方
周已得兒。有客恥臨湯餅會,孤雌空自繞林飛。」諸婦見詩,內有識
文墨者讀之,與眾笑曰:「彼道你舊年成親,今年得男。他的丈夫
幼,故無雄對,而孤雌自飛也。」眾婦遂皆笑之曰:「何不借一雄來
對乎?」蘇氏因在家中日求改嫁,公姑以其外家殷富,圖利其財,不
肯嫁之。
蘇氏歸而逼母,必欲改適,不願安於林家。母言於父,令往縣告
之,曰:
狀告為脫娶事。男女婚姻在於及時,年紀長幼,必貴相當。軾女蘇
氏年已十八,土豪林秉謙拴媒聘娶為長男婦。伊男已死,再求出親幼
男林達常,年方十三。長幼非偶,琴瑟不和。女鬱抱病,欲求改嫁。
人懼豪刁,避不敢娶。乞明斷離異,批允改嫁。長另配長,幼另配
幼,各安室家,永無反目。上告。
林秉謙去訴曰:
狀訴為懇賜完聚事。男女居室,人之大倫。一與之醮,終身不改。
女無惡德不出,士重嫁妻不良。男達常身軀雖小,年已十五,媒娶蘇
紹軾女為婦。歷今三年,相愛無異。軾聽讒唆,欲女改嫁。切婚姻居
五倫之先,節義乃綱常所重。無故出婦,有虧名教。乞臺扶植倫常,
理諭紹軾。勿聽離異,從前完娶,承祀宗祧,萬代感激。上訴。
時進土詹公揆為南海令。察其兩詞,便知林是而蘇非。及提對審,
力諭蘇紹軾以女宜令之從一以終,不可無故求異。蘇紹軾被官以理折
之,不能開辯。惟蘇氏嘵嘵辯說,以年紀不相當,必須再嫁。詹公判
曰:
桃花面,柳葉眉,玉指尖。跪丹墀,聲聲說道嫌夫少,只恐挫過少
年時。幾回傷感思春意,有此情,無此例﹔只判合,難判異。為爾批
定案卷底。更待二八青春時,分明好個風流婿。奈心情,強自遣,有
朝一日春風動,擺得花枝紅雨濺。
詹公不允其改嫁,蘇氏只得復歸林家。不二年,達常已長,而蘇氏
遂生一男。時詹公尚未去任。蘇氏後同他婦為人往寺保胎,適詹公到
寺,欲拜鄉親。諸婦見官來,皆趨入寺殿避之。蘇氏抱子行遲,衝其
引導,手下拿住,跪於轎前。詹公曰:「我有告示於各庵寺,凡官民
婦女不許入庵寺焚香拜佛,如有犯者罪及夫男。今你來寺何干?又衝
我引導,可報出夫男,拿來治罪。」蘇氏曰:「妾係蘇氏,為堂嬸保
胎而來寺,夫名林達常。」詹公記得其名,問曰:「汝即林達常之妻
乎,先年曾告夫小者是你也?」蘇氏曰:「是。」詹公曰:「汝抱此
子是誰的?」蘇氏曰:「是妾所生的。」詹公不覺發笑,曰:「夫小
亦能有子乎?可見春風有時動,好花終有主也。吾忽有詩興。且吟一
絕贈汝。詩云:『昔年曾怨春光少,今日花開春滿枝。不是春光著消
息,如何花實子離離。』」蘇氏曰:「妾今春初得子之時,亦不敢忘
老爺之恩。曾有拙句一絕云:『花欲移開別處栽,東皇不許我移開。
今日開花曾結子,都是東皇恩賜來。」』詹公曰:「汝可謂不背本
矣。你子曾取名否?」蘇氏曰:「未也。」詹公曰:「吾為你子取名
為林知本,且赦你衝引導之罪。」蘇氏拜謝而去。
按:婚姻而判合本為常例,特蘇氏得子而不忘判合之恩,詹公往寺
而因取知本之名,一時陡遇,亦不偶然,是亦一奇事也。然此惟詹公
之善判,蘇氏之知恩,故著為美談。若論父母為男女擇親,必當求其
年紀相當者,不可愛富慕財而扳緣附結,中間多有因而生事者,是宜
慎之。

龐通府判氣生子
南寧府民汪仁澤娶妻卓氏。其弟汪仁濟年十八歲,娶妻蒙氏,年止
十五。氏幼於夫,初合巹之時,被夫纏戀,嫩不慣經,含痛不樂。問
其夫曰:「是誰教人幹此事?」仁濟曰:「是周公制禮,教人配成夫
婦,行此事以生育男女,傳續後代也。」蒙氏恨之曰:「周公這老狗
何不早死,要他教人則甚?」乃閱月後,經歷雨露,知滋味美好,甚
喜悅之。又問夫曰:「周公還在否?」夫曰:「你問他則甚?」蒙氏
曰:「他教人為夫婦,此事真妙。若在時,我將做一雙鞋送他,以謝
其教。」夫曰:「他是古人,豈能著得你鞋?」自是夫婦好合,留戀
無厭,任情縱慾,不知節制。
三年之後,仁濟因病中犯房﹔陽證歸陰而死。蒙氏不勝痛哭,晝夜
思想其夫之恩愛。雖未有子,說他要守三年,滿服而後嫁。其伯母卓
氏亦與嬸蒙氏甚睦,自叔仁濟死後,夜當陪之宿。但卓氏有夫,雖陪
嬸睡,嘗在房中與夫媾合而後去。
一日,蒙氏先睡在?中,方思想春情。卓氏又與夫交合,戀久後方入
嬸?宿。蒙氏曰:「你又與大伯好來,故如此久。」卓氏曰:「或者有
之。」蒙氏歎曰:「你命何好,我命何薄也!」卓氏曰:「你思男子
乎?吾為爾當之。」遂升其腹,摟抱而耍。蒙氏思想已久,血盛精
壯,其陰戶開張。而卓氏方受夫精,陽氣充旺,抱合之際,其陽氣吸
入陰戶,透入子宮,盛陰之血裹之。是夜,卓氏與夫交者受胎,而蒙
氏受卓氏之餘陽者亦結胎。二人戲挽一番而睡。
自此夜後,卓氏懷孕日大,而蒙氏亦似有孕一般,疑不知其故。及
十月滿足,卓氏早生一男,叫穩婆李氏來養之。方訖,而將登席飲
酒。乃蒙氏在房中亦生一子,墮地之時,血兒只叫一聲而死。李穩婆
入看之,只疑其私胎也。蒙氏囑之曰:「爾晚間為我埋之。」李氏許
諾。及夜,裹之而出。
李氏與屠拯者最相好,密語之曰:「汪家蒙寡婦私生一子,托我裹
出,你可去埋之。」屠拯前月與汪仁澤爭田有隙,因領其私胎,以石
灰掩之。赴府告曰:
狀告為欺奸弟婦事,淫獸汪仁澤,伊弟仁濟夭死已久。愛弟婦蒙氏
美貌,拘留淫奸,視如寵妾。十一月二十九日,私生一孩,現在可
證。寡婦生子,姦情灼見。乞滴血證奸,依律正罪。綱常不亂,民不
禽犢。上告。
府批糧館審問,及提到,龐通府曰:「凡孕婦產婦,雖犯奸及死
罪,大明律中不許加刑,必產後百日外乃依罪加刑。今蒙氏犯奸是
的,但產後未滿百日,可保候出外,待限滿而後問。」屠拯執曰:
「蒙氏雖產,限內不可加刑,汪仁澤可先將滴血,若此孩是他真脈,
則蒙氏便可成獄矣。若遇百日後,恐血孩朽爛,或難驗視。」汪仁澤
曰:「我並與弟婦無私,不知他何處有子。我依屠拯所言,願先滴血
驗之。」
龐通府命仵作刮開孩子之骨,與仁澤滴血。仵作將孩子手足割開,
純是皮肉,並無寸骨。驚異稟曰:「此孩子渾身並無寸骨,不知何
故?」龐通府心中明白,命屠拯曰:「汝可自驗之,勿為仵作賣
法。」屠拯以布裹手,遍身摩捻,渾如肉毯。亦來稟曰:「果是無
骨。」龐通府曰:「凡男精為骨,陰血為肉。此孩純肉無骨,是未與
男精交媾,決無姦情矣。但何處感受陽氣,故陰血裹之而成胎也。墮
地只叫一聲而氣絕,此之謂氣生子也。」乃問蒙氏曰:「你何處感得
陽氣來?」蒙氏曰:「我並未與男子相接,何以感得陽氣?但我伯母
與夫睡後,來我肚上抱住戲耍,我慾心發動。後伯母是此時懷孕,而
我亦從此有胎。或者從伯母陰中受陽氣來乎?」龐通府曰:「即此是
也,彼受夫精方壯,而汝陰血亦壯,故受之而結胎。」乃將屠拯發打
二十,曰:「汝告蒙氏私胎,乃本等事。何為指定汪仁澤欺奸弟婦,
豈非誣告乎?」
龐通府判曰:
審得蒙氏早歲寡居,玉無瑕玷,空房孤守,冰比潔清。永夜漫漫,
獨宛鴛鴦之頸﹔芳春寂寂,懶妝粉黛之容。雖心甘槁木以自灰,顧氣
逐積陰而轉盛。被伯母摟抱,引動芳心﹔而腰肢磨蕩,滋萌春意。借
餘陽之鬱勃,流一氣以潛通。精與精孚,恍惚巫山入夢﹔氣隨氣徹,
發滋玉戶生機。以此懷胎,豈為野合?屠拯挾抱宿恨,中仇人以讒
鋒﹔懸捏姦情,陷節婦於塗炭。含沙射影,萬螫之毒難防﹔貝錦成
文,萋菲之口可畏。彼欺奸之情既雪,爾誣告之罪何逃?宜荷荊條,
乃發擺站。
按:氣生之事,隆古多有之。故感星貫月而生顓頊,踐跡虹繞而生
伏羲,皆氣生也。其後微眇者亦不著於史,故世亦罕聞焉。自龐侯發
之而雪寡婦之冤後,范侯師之而白室女之孕,世益知有氣生之說。然
亦甚罕稀矣,故並著之以為決獄剖疑之鑒。

范侯判室女成男
思州府民文煥采,生男基秀,年十八歲,新娶室元氏,年十七歲。
其女文英玉方十六歲,兄妹止隔一壁而寢。有一日,天方黎明時,基
秀與妻元氏行雲雨事,搖動牙?,低聲笑語。英玉在隔壁聞之,引動芳
心。適父在外,催基秀早起取帳。基秀房事方了,忙起出外。英玉開?
後偏門,裸體爬上嫂?,曰:「嫂嫂,凡女人與丈夫幹事何如?」嫂
曰:「汝不曉乎?你當妻,我當夫來教你。」便翻上英玉肚上去,兩
手摟抱,搖動腰肢,曰:「只是這等幹也。」英玉芳心方發,陰戶開
張。而元氏才受夫精充滿溢出,忽墜幾點陽精,滴入英玉陰中去。彼
陰氣方盛,神情已到,得此陽精,即包裹成胎。兩姑嫂戲耍一番,興
闌力倦而罷。
自此日起,嫂固與夫交而受胎,姑亦受嫂所滴下陽精而懷孕。經五
六個月,腹漸覺大,胎孩微動,與嫂無異。母覺而嚴究其故,拷問私
奸之人。英玉答以:「並無私情,止某日早晨與嫂抱耍之後,嫂有孕
而我亦似有孕,真不知何故。或是病乎?身又康健。或是孕乎?只與
嫂氏耍又無陰陽交媾,何以有孕?」嫂元氏亦如此證,母心不信,只
家庭嚴密,無人往來,女又朝夕在傍,不離跬步,何從偷奸?或者是
懷血塊乎,因此亦不理他。
及十月滿足,元氏卯時生一男,公姑喜悅。少頃,辰時英玉亦生一
男,父母焦燥之甚。父令母以桶水人,將此私孩淹死。英玉不肯,
曰:「嫂嫂生男,一家喜悅。我的偏要淹死,決是不肯。」母曰:
「嫂是有夫之子,你幹出這醜事,如何可與嫂比?」英玉曰:「我若
有醜事,天地不容,鬼神誅滅。真是我自然有子,或是大富大貴之
人,天意所生也。」母是慈性婦人,亦不忍淹此子。正無奈何,元氏
曰:「姑娘果無私事,此子必是個異人,或後日有大富貴福分亦未可
知。不如養起,傳言是我養雙生,亦可掩外人耳目也。」公姑聞元氏
所言極有理,即命洗養之。維時但張穩婆及僱工人廖印知是英玉所
生,乃厚賂穩婆,令勿言。
其冬,女夫家和倫遣僕送禮來,為兒和璧納酒。廖印抱英玉所生之
子,於門外戲而言其子曰:「今日你爹爹家來送禮,你美也。」和倫
之僕聞之,歸言於主。和倫大異,曰:「吾只聞其大妗養雙胎也,豈
其女生私胎而冒稱之乎?」遂密訪其當日之穩婆,知其為張氏也。及
長男婦將分娩,故去請張穩婆。和倫哄之曰:「此是我女兒有私胎,
故托言是媳婦。聞得今春文煥采女之私胎亦是你養,故敬請你來。此
中備銀一錢謝你,幸勿傳揚。」張氏不知是哄他,便言曰:「常禮亦
不止一錢,今你私胎宜厚謝我。前日文家乃是銀一兩,英玉小娘子又
私下以簪一根與我。今日須照此數也。」和倫已賺出,心中怒氣沖
天,驚曰:「我將告文家,將賺你作干證耳。我家豈有私胎耶!」便
遣媒往文家求退親。文家許退財禮八十兩,擔禮二十兩。和倫要他多
賠退還,因赴府告曰:
狀告為縱女犯奸事。倫忝世家,恪守禮義。次男和璧,憑煤笄聘文
煥采女文氏為婦。禮銀八十兩,擔銀共費六十兩。殊煥采全無家教,
女犯有孕,誕育一男,與采男基秀之長於並同年月日時。現在撫養,
與基秀子容貌相似。張氏、廖印可證。有此悖倫,願求退親。乞追財
禮擔銀,給領另娶。上告。
府批刑館問報,差牌來拘。煥采恐事情難辨,又托媒去講,願依狀
中銀數,賠銀一百四十兩與他,托去具息。和倫依之,去刑館遞息
詞。
范推官看狀中情,疑文氏與兄有奸,情理可惡,不准其息,必要調
審。將文氏拶起,問曰:「你與何人有奸,此於是誰所生?」文氏
曰:「此子是我自生,若問所奸之人,即拶死亦無。我今已有子矣,
情願撞死臺下。」即以頭擊柱,流血滿地。范推府見女子性烈,急令
人持住。再問曰:「汝道無姦夫,亦當說因何而有子?」文氏曰:
「妾與嫂隔壁而睡,黎明嫂與兄行房,妾春心發動。父親催兄早起取
帳。妾因過嫂?,嫂升我腹,抱住戲耍,妾時狂興越發,嫂精點滴墜入
我陰,從此姑嫂皆有孕,又同日生子,只先後一個時辰。母欲將我兒
溺死,我自恃無私因留撫養。若有姦夫,妾何膽敢養起此子,又何不
當日淹死以減滅口乎?」
范推府曰:「此可信也。吾南寧府亦有伯母與夫交後,往抱寡嬸戲
耍,寡嬸受伯母之陽氣,亦生一子而無骨。時龐通府判之以為氣生子
也。今汝之嫂未動身,陽精滿溢,汝過?之時,嫂摟抱你,滴精入戶,
此受得陽精,故子有骨而成人也。是雖有胎而無奸,亦未壞節辱身
矣。」和倫聞之,心下大悟,便曰:「如此則亦未污辱矣,此女必宜
於子者,吾不願退親,令與我兒完聚,後必是多男也。」乃復判合原
被,各供明無罪,發放寧家。人皆傳為奇事,而服范侯判斷之明也。
范推府判曰:
天之生人也,惟氣之所聚而形隨之以立。人之有生也,雖以形相禪
而實氣之所通,故華渚星臨,嫘祖感之而育少昊﹔而瑤光貫月,女樞
之而誕高陽。意動虹繞,伏羲肇作﹔踐跡心悅,后稷挺生。至兔望月
而受胎,若對視而卵實,皆以氣合,豈假形交?今文氏天癸已發,人
合未諧。春夢方醒,忽聽鄰壁之好﹔芳心乍發,旋登嫂氏之?。姑起狂
興而勃發生機,嫂惹餘陽而漏通春意。兩陰相合,雖無媾合之私﹔一
氣潛通,實有滋潤之益。苗望澤而時雨降,自是舒華﹔花正發而瑞露
滋,何不結實?即有在室之子,已無外通之夫。玉刻篆文,未傷完
璞﹔蓮出濁水,不柒污泥。何嫌關睢之好逑,可作和璧之佳偶。必有
螽斯之慶,永呈麟趾之祥。
按:此事判之甚難,幸范侯係南寧府人,親見龐侯判氣生子之事,
故啟其察識,知氣通精聚,亦可結胎,不必形交體合也。不然,文氏
難洗不白之疑,而嚴刑且不免矣。故知觀前人公案者,大有補於吏治
也。
*** END OF THE PROJECT GUTENBERG EBOOK 明鏡公案 ***

Updated editions will replace the previous one—the old editions will
be renamed.

Creating the works from print editions not protected by U.S.


copyright law means that no one owns a United States copyright in
these works, so the Foundation (and you!) can copy and distribute it
in the United States without permission and without paying
copyright royalties. Special rules, set forth in the General Terms of
Use part of this license, apply to copying and distributing Project
Gutenberg™ electronic works to protect the PROJECT GUTENBERG™
concept and trademark. Project Gutenberg is a registered trademark,
and may not be used if you charge for an eBook, except by following
the terms of the trademark license, including paying royalties for use
of the Project Gutenberg trademark. If you do not charge anything
for copies of this eBook, complying with the trademark license is
very easy. You may use this eBook for nearly any purpose such as
creation of derivative works, reports, performances and research.
Project Gutenberg eBooks may be modified and printed and given
away—you may do practically ANYTHING in the United States with
eBooks not protected by U.S. copyright law. Redistribution is subject
to the trademark license, especially commercial redistribution.

START: FULL LICENSE


THE FULL PROJECT GUTENBERG LICENSE
PLEASE READ THIS BEFORE YOU DISTRIBUTE OR USE THIS WORK

To protect the Project Gutenberg™ mission of promoting the free


distribution of electronic works, by using or distributing this work (or
any other work associated in any way with the phrase “Project
Gutenberg”), you agree to comply with all the terms of the Full
Project Gutenberg™ License available with this file or online at
www.gutenberg.org/license.

Section 1. General Terms of Use and


Redistributing Project Gutenberg™
electronic works
1.A. By reading or using any part of this Project Gutenberg™
electronic work, you indicate that you have read, understand, agree
to and accept all the terms of this license and intellectual property
(trademark/copyright) agreement. If you do not agree to abide by all
the terms of this agreement, you must cease using and return or
destroy all copies of Project Gutenberg™ electronic works in your
possession. If you paid a fee for obtaining a copy of or access to a
Project Gutenberg™ electronic work and you do not agree to be
bound by the terms of this agreement, you may obtain a refund
from the person or entity to whom you paid the fee as set forth in
paragraph 1.E.8.

1.B. “Project Gutenberg” is a registered trademark. It may only be


used on or associated in any way with an electronic work by people
who agree to be bound by the terms of this agreement. There are a
few things that you can do with most Project Gutenberg™ electronic
works even without complying with the full terms of this agreement.
See paragraph 1.C below. There are a lot of things you can do with
Project Gutenberg™ electronic works if you follow the terms of this
agreement and help preserve free future access to Project
Gutenberg™ electronic works. See paragraph 1.E below.
1.C. The Project Gutenberg Literary Archive Foundation (“the
Foundation” or PGLAF), owns a compilation copyright in the
collection of Project Gutenberg™ electronic works. Nearly all the
individual works in the collection are in the public domain in the
United States. If an individual work is unprotected by copyright law
in the United States and you are located in the United States, we do
not claim a right to prevent you from copying, distributing,
performing, displaying or creating derivative works based on the
work as long as all references to Project Gutenberg are removed. Of
course, we hope that you will support the Project Gutenberg™
mission of promoting free access to electronic works by freely
sharing Project Gutenberg™ works in compliance with the terms of
this agreement for keeping the Project Gutenberg™ name associated
with the work. You can easily comply with the terms of this
agreement by keeping this work in the same format with its attached
full Project Gutenberg™ License when you share it without charge
with others.

1.D. The copyright laws of the place where you are located also
govern what you can do with this work. Copyright laws in most
countries are in a constant state of change. If you are outside the
United States, check the laws of your country in addition to the
terms of this agreement before downloading, copying, displaying,
performing, distributing or creating derivative works based on this
work or any other Project Gutenberg™ work. The Foundation makes
no representations concerning the copyright status of any work in
any country other than the United States.

1.E. Unless you have removed all references to Project Gutenberg:

1.E.1. The following sentence, with active links to, or other


immediate access to, the full Project Gutenberg™ License must
appear prominently whenever any copy of a Project Gutenberg™
work (any work on which the phrase “Project Gutenberg” appears,
or with which the phrase “Project Gutenberg” is associated) is
accessed, displayed, performed, viewed, copied or distributed:
Welcome to our website – the perfect destination for book lovers and
knowledge seekers. We believe that every book holds a new world,
offering opportunities for learning, discovery, and personal growth.
That’s why we are dedicated to bringing you a diverse collection of
books, ranging from classic literature and specialized publications to
self-development guides and children's books.

More than just a book-buying platform, we strive to be a bridge


connecting you with timeless cultural and intellectual values. With an
elegant, user-friendly interface and a smart search system, you can
quickly find the books that best suit your interests. Additionally,
our special promotions and home delivery services help you save time
and fully enjoy the joy of reading.

Join us on a journey of knowledge exploration, passion nurturing, and


personal growth every day!

ebookbell.com

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy