
- •Contents
- •Preface
- •Why Do We Need Databases?
- •What’s Up in the Kingdom?
- •A Database—That’s Our Solution!
- •Summary
- •Database Terms
- •Relational Databases
- •Types of Data Models
- •Data Extraction Operations
- •Questions
- •The Relational Database Prevails!
- •Summary
- •Answers
- •The E-R Model
- •Normalizing a Table
- •What Is the E-R Model?
- •How to Analyze the E-R Model
- •Normalizing a Table
- •Steps for Designing a Database
- •Answers
- •Using SQL
- •Searching for Data Using a SELECT Statement
- •Using Aggregate Functions
- •Joining Tables
- •Creating a Table
- •SQL Overview
- •Searching for Data Using a SELECT Statement
- •Creating Conditions
- •Aggregate Functions
- •Searching for Data
- •Joining Tables
- •Creating a Table
- •Summary
- •Answers
- •What Is a Transaction?
- •What Is a Lock?
- •Database Security
- •Speeding Things Up with Indexing
- •Disaster Recovery
- •Properties of Transactions
- •When Disaster Strikes
- •Indexes
- •Optimizing a Query
- •Summary
- •Answers
- •Databases in Use
- •Databases and the Web
- •Distributed Databases
- •Stored Procedures and Triggers
- •Databases on the Web
- •What Is a Distributed Database?
- •Partitioning Data
- •Preventing Inconsistencies with a Two-Phase Commit
- •Database Replication
- •Further Application of Databases
- •Summary
- •Answers
- •Closing Remarks
- •References
- •Index
- •About the Author
- •Updates
- •More Manga Guides

Answers
Q1 |
Sta |
Q2 |
B k |
Q3 |
Students |
Q4 |
Customer |
|
member |
|
|
|
|||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
|
m |
|
m |
1 |
|
|
Managing |
|
Lending |
|
A ending |
|
Opening |
|
N |
|
N |
|
N |
|
N |
|
|
|
|
|
|
|
|
|
Customers |
|
Students |
|
Lectures |
|
A ount |
|
|
|
|
|
|
|
|
|
|
|
|
|
m |
|
m |
|
|
|
|
|
Teaching |
|
Management |
|
|
|
|
1 |
1 |
||
|
|
|
|
|
|
|
|
|
|
|
|
|
Teacher |
|
Bank |
|
|
|
|
|
|
|
|
Q5 Second normal form
Q6 Third normal form
Q7
Staff member code |
|
Month |
Member’s sales |
|
||
|
|
|
|
|
|
|
|
|
|
|
|
||
Staff member code |
|
Staff member name |
Department code |
|||
|
|
|
|
|
||
|
|
|
||||
Department code |
Department name |
|
||||
|
|
|
|
|
|
|
82 Chapter 3

Q8
Order-taking code |
|
Date |
Customer code |
|
Representative code |
|
|||||||||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Customer code |
|
Customer name |
|
|
|
|
|
|
|
|
|
|
|||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Order-taking code |
|
Product code |
|
|
Quantity |
|
|
|
|
||||||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
||
|
|
|
|
|
|
|
|
|
|
|
|
||||
Product code |
Product name |
Unit price |
|
|
|
|
|
|
|
||||||
|
|
|
|
|
|
|
|
|
|
|
|
|
|||
|
|
|
|
|
|
|
|
|
|
|
|||||
Representative code |
|
Representative name |
|
|
|
|
|
|
|
||||||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Q9 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|||||
Order-taking code |
|
Date |
Customer code |
|
|
|
|
|
|
|
|||||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
||
Customer code |
|
Customer name |
|
|
|
|
|
|
|
|
|
|
|||
|
|
|
|
|
|
|
|
|
|
|
|||||
|
|
|
|
|
|
|
|
|
|
|
|||||
Order-taking code |
|
Product code |
|
|
Quantity |
|
|
|
|
||||||
|
|
|
|
|
|
|
|
|
|||||||
|
|
|
|
|
|
||||||||||
Product code |
Product classification code |
Product name |
Unit price |
||||||||||||
|
|
|
|
|
|
|
|||||||||
|
|
|
|
|
|||||||||||
Product classification code |
Product classification name |
|
|
|
|||||||||||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Let's Design a Database! 83

Designing a Database
In this chapter, you learned how to design a relational database. However, there are other database design methods. Usability and efficiency of a database depend on an analysis and design method. Therefore, it is important to create an appropriate database in the design stage.
In the database design stage, you need to perform various tasks in addition to table design. For example, you need to consider a datatype to use in the table. You may also need to specify columns indicating numerical values, currencies, and character strings. In addition, you need to devise a search method so you can carry out fast searches. Sometimes, you must create a design while keeping physical file organization in mind. And you have to control which users can access the database to ensure security. There are many factors you need to think about when designing a database. We’ll look at some of these factors in the following chapters.
84 Chapter 3

4
Let's Learn About SQL!