《数据库处理――基础设计与实现(第十版)》第四章PPT课件

合集下载
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

FROM
SKU_DATA
WHERE
Buyer NOT IT
(SELECT Buyer
FROM
SKU_DATA, BUYER
WHERE SKU_DATA.BUYER =
BUYER.Buyer’S DATABASE PROCESSING, 10th Edition
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition
4-11
Non-Normalized Table: EQUIPMENT_REPAIR
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition
4-12
4-8
Type of Database
• Updateable database or read-only database?
• If updateable database, we normally want tables in BCNF
• If read-only database, we may not use BCNF tables
• To count the number of rows in a table use the SQL built-in function COUNT(*):
SELECT COUNT(*) AS NumRows
FROM
SKU_DATA;
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition
4-7
Checking Validity of Assumed Referential Integrity Constraints
• To find any foreign key values that violate the foreign key constraint:
SELECT
Buyer
received, or should it be transformed for storage?
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition
4-2
How Many Tables?
Should we store these two tables as they are, or should we combine them into one table in our new database?
4-1
Chapter Premise
• We have received one or more tables of existing data
• The data is to be stored in a new database • QUESTION: Should the data be stored as
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition
4-3
Assessing Table Structure
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition
4-4
Counting Rows in a Table
Normalized Tables: ITEM and REPAIR
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition
4-13
Copying Data to New Tables
• To copy data from one table to another, use the SQL command INSERT INTO TableName command:
David M. Kroenke’s
Database Processing:
Fundamentals, Design, and Implementation
Chapter Four:
Database Design
Using Normalization
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition
4-5
Examining the Columns
• To determine the number and type of columns in a table, use an SQL SELECT statement
• To limit the number of rows retreived, use the SQL TOP {NumberOfRows} keyword:
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition
4-9
Designing Updateable Databases
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition
4-10
Normalization: Advantages and Disadvantages
SKU_DATA (SKU, SKU_Description, Department, Buyer)
BUYER
(BuyerName, Department)
Where SKU_DATA.Buyer must exist in BUYER.BuyerName
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition
INSERT INTO ITEM
SELECT FROM
TOP (10) * SKU_DATA;
DAVID M. KROENKE’S DATABASE PROCESSING, 10th Edition
4-6
Checking Validity of Assumed Referential Integrity Constraints
• Given two tables with an assumed foreign key constraint:
相关文档
最新文档