Top Banner
Getting Started with Oracle MySQL 5.5 Community Server Edition Appendix C DAVID M. KROENKE and DAVID J. AUER DATABASE CONCEPTS, 6 th Edition
55

Getting Started with Oracle MySQL 5.5 Community Server Edition Appendix C DAVID M. KROENKE and DAVID J. AUER DATABASE CONCEPTS, 6 th Edition.

Dec 21, 2015

Download

Documents

Iris Hardy
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Getting Started with Oracle MySQL 5.5 Community Server Edition Appendix C DAVID M. KROENKE and DAVID J. AUER DATABASE CONCEPTS, 6 th Edition.

Getting Started withOracle MySQL 5.5 Community Server Edition

Appendix C

DAVID M. KROENKE and DAVID J. AUER

DATABASE CONCEPTS, 6th Edition

Page 2: Getting Started with Oracle MySQL 5.5 Community Server Edition Appendix C DAVID M. KROENKE and DAVID J. AUER DATABASE CONCEPTS, 6 th Edition.

All rights reserved. No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in any form or by any means,

electronic, mechanical, photocopying, recording, or otherwise, without the prior written permission of the publisher. Printed in the United States

of America.

Copyright © 2013 Pearson Education, Inc.  Publishing as Prentice Hall

KROENKE and AUER - DATABASE CONCEPTS (6th Edition) Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall

C-2

Page 3: Getting Started with Oracle MySQL 5.5 Community Server Edition Appendix C DAVID M. KROENKE and DAVID J. AUER DATABASE CONCEPTS, 6 th Edition.

Appendix Objectives

• Learn how to create a database in MySQL 5.5 Community Server Edition

• Learn how to submit SQL commands to create table structures

• Learn how to submit SQL commands to insert database data

• Learn how to submit SQL commands to query a database

KROENKE and AUER - DATABASE CONCEPTS (6th Edition) Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall

C-3

Page 4: Getting Started with Oracle MySQL 5.5 Community Server Edition Appendix C DAVID M. KROENKE and DAVID J. AUER DATABASE CONCEPTS, 6 th Edition.

Appendix Objectives(continued)

• Learn how to install the MySQL OBDC/Connector

• Learn how to create database designs in the MySQL Workbench

KROENKE and AUER - DATABASE CONCEPTS (6th Edition) Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall

C-4

Page 5: Getting Started with Oracle MySQL 5.5 Community Server Edition Appendix C DAVID M. KROENKE and DAVID J. AUER DATABASE CONCEPTS, 6 th Edition.

MySQL Components

1. IMPORTANT NOTE: If you are using the Windows operating system, download and install the MySQL 5.5 Community Server Edition components only by downloading and using the MySQL Installer for Windows.

2. MySQL 5.5 Community Server Edition. Download the current generally available (GA) version for your operating system.

3. MySQL Workbench. The MySQL Workbench has replaced the MySQL GUI Tools (The MySQL Query Browser and MySQL Administrator) as the graphical administration and SQL command utility for MySQL. In addition, it can be used for database design as described in Chapter 5.

4. MySQL Connector/ODBC. This provides the ODBC programs necessary to provide Web application connectivity to a MySQL database as described in Chapter 7.

KROENKE and AUER - DATABASE CONCEPTS (6th Edition) Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall

C-5

Page 6: Getting Started with Oracle MySQL 5.5 Community Server Edition Appendix C DAVID M. KROENKE and DAVID J. AUER DATABASE CONCEPTS, 6 th Edition.

The MySQL Workspace Folder inWindows Explorer

KROENKE and AUER - DATABASE CONCEPTS (6th Edition) Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall

C-6

Figure C-1: The MySQL-Workspace Folder in Windows Explorer

Page 7: Getting Started with Oracle MySQL 5.5 Community Server Edition Appendix C DAVID M. KROENKE and DAVID J. AUER DATABASE CONCEPTS, 6 th Edition.

The MySQL Workbench Home Tab

KROENKE and AUER - DATABASE CONCEPTS (6th Edition) Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall

C-7

Figure C-2: The MySQL Workbench Home Tab

Page 8: Getting Started with Oracle MySQL 5.5 Community Server Edition Appendix C DAVID M. KROENKE and DAVID J. AUER DATABASE CONCEPTS, 6 th Edition.

By The Way!

• The folks who work on the MySQL Workbench have no qualms about making major GUI changes in minor version upgrades of the product.

• Compare Figure 3-15 to Figure C-17 (Slide C-26 in this PowerPoint slideshow). Do you see the new, editable data row below row 12 in the query results in Figure C-17 that is not in Figure 3-15? That happened between preparing the Chapter 3 text and Appendix C text (which was finalized latter in the production process).

• Expect to see similar differences in the version of MySQL Workbench you download and use. The same functionality will be there, but perhaps implemented slightly differently! Be aware and be prepared!

KROENKE and AUER - DATABASE CONCEPTS (6th Edition) Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall

C-8

Page 9: Getting Started with Oracle MySQL 5.5 Community Server Edition Appendix C DAVID M. KROENKE and DAVID J. AUER DATABASE CONCEPTS, 6 th Edition.

The Connect to Database Dialog Box

KROENKE and AUER - DATABASE CONCEPTS (6th Edition) Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall

C-9

Figure C-3: The Connect to Database Dialog Box

Page 10: Getting Started with Oracle MySQL 5.5 Community Server Edition Appendix C DAVID M. KROENKE and DAVID J. AUER DATABASE CONCEPTS, 6 th Edition.

The Connect to MySQL Server Instance Dialog Box

KROENKE and AUER - DATABASE CONCEPTS (6th Edition) Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall

C-10

Figure C-4: The Connect to MySQL Server Dialog Box

Page 11: Getting Started with Oracle MySQL 5.5 Community Server Edition Appendix C DAVID M. KROENKE and DAVID J. AUER DATABASE CONCEPTS, 6 th Edition.

The MySQL Object Browserand SQL Query Tabbed Window

KROENKE and AUER - DATABASE CONCEPTS (6th Edition) Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall

C-11

Figure C-5: The Object Browser and the SQL File Tabbed Window

Page 12: Getting Started with Oracle MySQL 5.5 Community Server Edition Appendix C DAVID M. KROENKE and DAVID J. AUER DATABASE CONCEPTS, 6 th Edition.

The Create Schema Button

KROENKE and AUER - DATABASE CONCEPTS (6th Edition) Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall

C-12

Figure C-6: The new_schema Tabbed Window

Page 13: Getting Started with Oracle MySQL 5.5 Community Server Edition Appendix C DAVID M. KROENKE and DAVID J. AUER DATABASE CONCEPTS, 6 th Edition.

Naming the New Database

KROENKE and AUER - DATABASE CONCEPTS (6th Edition) Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall

C-13

Figure C-7: The WPC Schema Name in the new_schema Dialog Box

Page 14: Getting Started with Oracle MySQL 5.5 Community Server Edition Appendix C DAVID M. KROENKE and DAVID J. AUER DATABASE CONCEPTS, 6 th Edition.

The Apply SQL Script to Database — Review SQL Script Dialog Box

KROENKE and AUER - DATABASE CONCEPTS (6th Edition) Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall

C-14

Figure C-8:The Apply SQL Script to Database – Review SQL Script Dialog Box

Page 15: Getting Started with Oracle MySQL 5.5 Community Server Edition Appendix C DAVID M. KROENKE and DAVID J. AUER DATABASE CONCEPTS, 6 th Edition.

The Apply SQL Script to Database — Apply SQL Script Dialog Box

KROENKE and AUER - DATABASE CONCEPTS (6th Edition) Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall

C-15

Figure C-9:The Apply SQL Script to Database—Apply SQL Script Dialog Box

Page 16: Getting Started with Oracle MySQL 5.5 Community Server Edition Appendix C DAVID M. KROENKE and DAVID J. AUER DATABASE CONCEPTS, 6 th Edition.

The New Database (Schema)in the Object Browser

KROENKE and AUER - DATABASE CONCEPTS (6th Edition) Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall

C-16

Figure C-10: The wpc Schema (Database) in the Object Browser

Page 17: Getting Started with Oracle MySQL 5.5 Community Server Edition Appendix C DAVID M. KROENKE and DAVID J. AUER DATABASE CONCEPTS, 6 th Edition.

The Set as Default Schema Command

KROENKE and AUER - DATABASE CONCEPTS (6th Edition) Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall

C-17

Figure C-11: The Set as Default Schema Command

Page 18: Getting Started with Oracle MySQL 5.5 Community Server Edition Appendix C DAVID M. KROENKE and DAVID J. AUER DATABASE CONCEPTS, 6 th Edition.

WPC as the Active Schema (Default Schema)

KROENKE and AUER - DATABASE CONCEPTS (6th Edition) Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall

C-18

Figure C-12:The WPC Schema as the Active Schema (Default Schema)Command

Page 19: Getting Started with Oracle MySQL 5.5 Community Server Edition Appendix C DAVID M. KROENKE and DAVID J. AUER DATABASE CONCEPTS, 6 th Edition.

AUTO_INCREMENT

KROENKE and AUER - DATABASE CONCEPTS (6th Edition) Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall

• MySQL uses the AUTO_INCREMENT keyword to set surrogate key values.

• The default values for AUTO_INCREMENT are an initial value of 1 and an increment of 1.

• After the table is created, you can modify the initial value by using the ALTER TABLE statement. For example, in the WPC database, the PROJECT table has a surrogate key that starts at 1000 and increments by 100. You could set the correct initial value by using the SQL statement:

ALTER TABLE PROJECT AUTO_INCREMENT=1000;

• Unfortunately, you cannot change the MySQL increment of 1. So for cases such as the ProjectID values in PROJECT, you need to manually insert the correct values in MySQL.

C-19

Page 20: Getting Started with Oracle MySQL 5.5 Community Server Edition Appendix C DAVID M. KROENKE and DAVID J. AUER DATABASE CONCEPTS, 6 th Edition.

The WPC Database TableSQL Statements for MySQL I

KROENKE and AUER - DATABASE CONCEPTS (6th Edition) Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall

C-20

Figure C-13: The WPC Database Table SQL Statements for MySQL

Page 21: Getting Started with Oracle MySQL 5.5 Community Server Edition Appendix C DAVID M. KROENKE and DAVID J. AUER DATABASE CONCEPTS, 6 th Edition.

The WPC Database TableSQL Statements for MySQL II

KROENKE and AUER - DATABASE CONCEPTS (6th Edition) Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall

C-21

Figure C-13: The WPC Database Table SQL Statements for MySQL (cont’d)

Page 22: Getting Started with Oracle MySQL 5.5 Community Server Edition Appendix C DAVID M. KROENKE and DAVID J. AUER DATABASE CONCEPTS, 6 th Edition.

The WPC Database TableSQL Statements for MySQL III

KROENKE and AUER - DATABASE CONCEPTS (6th Edition) Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall

C-22

Figure C-13: The WPC Database Table SQL Statements for MySQL (cont’d)

Page 23: Getting Started with Oracle MySQL 5.5 Community Server Edition Appendix C DAVID M. KROENKE and DAVID J. AUER DATABASE CONCEPTS, 6 th Edition.

The WPC SQL Scriptin the MySQL Workbench

KROENKE and AUER - DATABASE CONCEPTS (6th Edition) Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall

C-23

Figure C-14: The WPC Script in the MySQL Workbench

Page 24: Getting Started with Oracle MySQL 5.5 Community Server Edition Appendix C DAVID M. KROENKE and DAVID J. AUER DATABASE CONCEPTS, 6 th Edition.

The WPC SQL Script Resultsin the MySQL Workbench

KROENKE and AUER - DATABASE CONCEPTS (6th Edition) Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall

C-24

Figure C-15: The SQL Script Results

Page 25: Getting Started with Oracle MySQL 5.5 Community Server Edition Appendix C DAVID M. KROENKE and DAVID J. AUER DATABASE CONCEPTS, 6 th Edition.

The WPC SQL INSERT Statements for PROJECT

KROENKE and AUER - DATABASE CONCEPTS (6th Edition) Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall

MySQL expects dates to be entered using a very specific format: 'YYYY-MM-DD'

Note how this format is used in the SQL INSERT INTO PROJECT commands below:

C-25

Figure C-16: The WPC Database Data INSERT Statements for MySQL

Page 26: Getting Started with Oracle MySQL 5.5 Community Server Edition Appendix C DAVID M. KROENKE and DAVID J. AUER DATABASE CONCEPTS, 6 th Edition.

An SQL Query and Query Results in the MySQL Workbench

KROENKE and AUER - DATABASE CONCEPTS (6th Edition) Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall

C-26

Figure C-17: The SQL Query and Results in the MySQL Workbench

Page 27: Getting Started with Oracle MySQL 5.5 Community Server Edition Appendix C DAVID M. KROENKE and DAVID J. AUER DATABASE CONCEPTS, 6 th Edition.

The MySQL Connector/ODBC

KROENKE and AUER - DATABASE CONCEPTS (6th Edition) Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall

• IMPORTANT NOTE: If you are using the Windows operating system, download and install the MySQL Connector/ODBC component only by downloading and using the MySQL Installer for Windows.

• For non-Windows operating systems, the MySQL Connector/ODBC must be installed as a separate installation for the other MySQL components.

• Download the MySQL Connector/ODBC form the MySQL Website at http://dev.mysql.com/downloads/connector/odbc/.

• Run the installation routine. • As soon as the install is complete, the MySQL ODBC 5.1

Driver will be available in the ODBC Data Source Administrator.

C-27

Page 28: Getting Started with Oracle MySQL 5.5 Community Server Edition Appendix C DAVID M. KROENKE and DAVID J. AUER DATABASE CONCEPTS, 6 th Edition.

The MySQL Workbench Data Modeling Area

KROENKE and AUER - DATABASE CONCEPTS (6th Edition) Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall

C-28

Figure C-1: The MySQL Workbench Home Tab

Page 29: Getting Started with Oracle MySQL 5.5 Community Server Edition Appendix C DAVID M. KROENKE and DAVID J. AUER DATABASE CONCEPTS, 6 th Edition.

Creating Database Designs in the MySQL Workbench

KROENKE and AUER - DATABASE CONCEPTS (6th Edition) Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall

To create a new data model in the MySQL Workbench, you can:

• Use the File | New Model command, or• Click the Create new EER Model link on the Home page.

C-29

Page 30: Getting Started with Oracle MySQL 5.5 Community Server Edition Appendix C DAVID M. KROENKE and DAVID J. AUER DATABASE CONCEPTS, 6 th Edition.

The MySQL Model Tab and Window

KROENKE and AUER - DATABASE CONCEPTS (6th Edition) Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall

C-30

Figure C-18: The MySQL Model Tab and Window

Page 31: Getting Started with Oracle MySQL 5.5 Community Server Edition Appendix C DAVID M. KROENKE and DAVID J. AUER DATABASE CONCEPTS, 6 th Edition.

The Blank E-R Diagram

KROENKE and AUER - DATABASE CONCEPTS (6th Edition) Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall

C-31

Figure C-19: The Blank E-R Diagram

Page 32: Getting Started with Oracle MySQL 5.5 Community Server Edition Appendix C DAVID M. KROENKE and DAVID J. AUER DATABASE CONCEPTS, 6 th Edition.

Placing the Table Object

KROENKE and AUER - DATABASE CONCEPTS (6th Edition) Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall

C-32

Figure C-20: Placing the Table Object

Page 33: Getting Started with Oracle MySQL 5.5 Community Server Edition Appendix C DAVID M. KROENKE and DAVID J. AUER DATABASE CONCEPTS, 6 th Edition.

The table1 Table Object

KROENKE and AUER - DATABASE CONCEPTS (6th Edition) Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall

C-33

Figure C-21: The table1 Table Object

Page 34: Getting Started with Oracle MySQL 5.5 Community Server Edition Appendix C DAVID M. KROENKE and DAVID J. AUER DATABASE CONCEPTS, 6 th Edition.

The MySQL Table Editor

KROENKE and AUER - DATABASE CONCEPTS (6th Edition) Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall

C-34

Figure C-22: The MySQL Table Editor

Page 35: Getting Started with Oracle MySQL 5.5 Community Server Edition Appendix C DAVID M. KROENKE and DAVID J. AUER DATABASE CONCEPTS, 6 th Edition.

The Renamed Table

KROENKE and AUER - DATABASE CONCEPTS (6th Edition) Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall

C-35

Figure C-23: The Renamed Table

Page 36: Getting Started with Oracle MySQL 5.5 Community Server Edition Appendix C DAVID M. KROENKE and DAVID J. AUER DATABASE CONCEPTS, 6 th Edition.

MySQL Workbench Table Column Checkbox Options

KROENKE and AUER - DATABASE CONCEPTS (6th Edition) Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall

• PK Primary Key—Check if this column is the primary key or part of a composite primary key.

• NN NOT NULL—Check if this column must have an inserted value.

• UQ UNIQUE—Check if this column must contain a unique value. • BIN Binary—Check if this the column uses only two values, such

as 0 and 1 or Yes and No. • UN Unsigned Data Type—Check if this column uses numbers

without negative values and you specifically want to not permit negative numbers where they might otherwise be allowed. Zero fill (ZF) numbers are automatically check UN.

• ZF Zero Fill—Check if this column should be automatically filled with zeros.

• AI AUTO_INCREMENT—Check if this column is a primary key that should have sequential surrogate key values

C-36

Page 37: Getting Started with Oracle MySQL 5.5 Community Server Edition Appendix C DAVID M. KROENKE and DAVID J. AUER DATABASE CONCEPTS, 6 th Edition.

The Generated Primary Key idDEPARTMENT

KROENKE and AUER - DATABASE CONCEPTS (6th Edition) Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall

C-37

Figure C-24:The MySQL Table Editor Generated Primary Key idDEPARTMENT

Page 38: Getting Started with Oracle MySQL 5.5 Community Server Edition Appendix C DAVID M. KROENKE and DAVID J. AUER DATABASE CONCEPTS, 6 th Edition.

The Datatype Drop-Down List

KROENKE and AUER - DATABASE CONCEPTS (6th Edition) Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall

C-38

Figure C-25: The Datatype Drop-Down List

Page 39: Getting Started with Oracle MySQL 5.5 Community Server Edition Appendix C DAVID M. KROENKE and DAVID J. AUER DATABASE CONCEPTS, 6 th Edition.

The Completed DepartmentNamePrimary Key Column

KROENKE and AUER - DATABASE CONCEPTS (6th Edition) Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall

C-39

Figure C-26: The Completed DepartmentName Primary Key Column

Page 40: Getting Started with Oracle MySQL 5.5 Community Server Edition Appendix C DAVID M. KROENKE and DAVID J. AUER DATABASE CONCEPTS, 6 th Edition.

The Completed DEPARTMENT Table

KROENKE and AUER - DATABASE CONCEPTS (6th Edition) Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall

C-40

Figure C-27: The Completed DEPARTMENT Table

Page 41: Getting Started with Oracle MySQL 5.5 Community Server Edition Appendix C DAVID M. KROENKE and DAVID J. AUER DATABASE CONCEPTS, 6 th Edition.

The Completed DEPARTMENT, EMPLOYEE and PROJECT Tables

KROENKE and AUER - DATABASE CONCEPTS (6th Edition) Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall

C-41

Figure C-28:The Completed DEPARTMENT, EMPLOYEE and PROJECT Tables

Page 42: Getting Started with Oracle MySQL 5.5 Community Server Edition Appendix C DAVID M. KROENKE and DAVID J. AUER DATABASE CONCEPTS, 6 th Edition.

Relationships in the MySQL Workbench EER Diagram Toolbar

KROENKE and AUER - DATABASE CONCEPTS (6th Edition) Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall

C-42

Figure C-29: Relationships in the MySQL Workbench EER Diagram Toolbar

Page 43: Getting Started with Oracle MySQL 5.5 Community Server Edition Appendix C DAVID M. KROENKE and DAVID J. AUER DATABASE CONCEPTS, 6 th Edition.

MySQL WorkbenchRelationship Button Options

KROENKE and AUER - DATABASE CONCEPTS (6th Edition) Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall

• 1:1 Nonidentifying Relationship—Used between two strong entities.

• 1:N Nonidentifying Relationship—Used between two strong entities.

• 1:1 Identifying Relationship—Used between a strong entity and an ID-dependent weak entity—BUT an identifying relationship requires multiple children, so this does not make sense!

• 1:N Identifying Relationship—Used between a strong entity and an ID-dependent weak entity.

• N:M Identifying Relationship— Used between a strong entity and an ID-dependent weak entity—BUT because a N:M relationship is between two strong entities, this should be nondentifying! HOWEVER, it is immediately converted to two 1:N ID-dependent identifying relationships as discussed below.

• Place a Relationship Using Existing Columns—See discussion below.

C-43

Page 44: Getting Started with Oracle MySQL 5.5 Community Server Edition Appendix C DAVID M. KROENKE and DAVID J. AUER DATABASE CONCEPTS, 6 th Edition.

By the Way

• The usage of 1:1 nonidentifying, 1:N nonidentifying, and 1:N identifying relationships are standard and correct.

• However, by definition an identifying relationship has to be used in a 1:N relationship (see Chapter 4), so the 1:1 identifying relationship does not make sense.

• Similarly, pure N:M relationships only exist in data models, and they are always nonidentifying relationships between two strong entities, so this symbol should use a dashed line instead of a solid one.

KROENKE and AUER - DATABASE CONCEPTS (6th Edition) Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall

C-44

Page 45: Getting Started with Oracle MySQL 5.5 Community Server Edition Appendix C DAVID M. KROENKE and DAVID J. AUER DATABASE CONCEPTS, 6 th Edition.

By the Way

• The MySQL Workbench uses the term non-identifying relationship, whereas in Database Concepts we use the term nonidentifying relationship. We have seen the term non identifying relationship used in other contexts.

• All three terms mean exactly the same thing, and which is used is a matter of style. As MySQL Workbench uses non-identifying, we will also use that term in this appendix for consistency with the MySQL Workbench screen shots, while remaining well aware that we have used nonidentfying in Database Concepts itself.

KROENKE and AUER - DATABASE CONCEPTS (6th Edition) Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall

C-45

Page 46: Getting Started with Oracle MySQL 5.5 Community Server Edition Appendix C DAVID M. KROENKE and DAVID J. AUER DATABASE CONCEPTS, 6 th Edition.

Place a Relationship Using Existing ColumnsThe Foreign Key Columns Dialog Box – Pick

Columns for Foreign Key

KROENKE and AUER - DATABASE CONCEPTS (6th Edition) Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall

C-46

Figure C-30:The Foreign Key Columns Dialog Box—Pick Columns for Foreign Key

Page 47: Getting Started with Oracle MySQL 5.5 Community Server Edition Appendix C DAVID M. KROENKE and DAVID J. AUER DATABASE CONCEPTS, 6 th Edition.

Place a Relationship Using Existing ColumnsEMPLOYEE.Department Selected

as The Foreign Key Column

KROENKE and AUER - DATABASE CONCEPTS (6th Edition) Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall

C-47

Figure C-31:EMPLOYEE.Department Selected As the Foreign Key Column

Page 48: Getting Started with Oracle MySQL 5.5 Community Server Edition Appendix C DAVID M. KROENKE and DAVID J. AUER DATABASE CONCEPTS, 6 th Edition.

Place a Relationship Using Existing ColumnsThe Referenced Columns Dialog Box – Pick

Referenced Primary Key

KROENKE and AUER - DATABASE CONCEPTS (6th Edition) Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall

C-48

Figure C-32: The Referenced Columns Dialog Box—Pick Referenced Primary Key

Page 49: Getting Started with Oracle MySQL 5.5 Community Server Edition Appendix C DAVID M. KROENKE and DAVID J. AUER DATABASE CONCEPTS, 6 th Edition.

Place a Relationship Using Existing ColumnsThe Completed

1:N Non-identifying Relationship

KROENKE and AUER - DATABASE CONCEPTS (6th Edition) Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall

C-49

Figure C-33: The Completed 1:N Non-identifying Relationship

Page 50: Getting Started with Oracle MySQL 5.5 Community Server Edition Appendix C DAVID M. KROENKE and DAVID J. AUER DATABASE CONCEPTS, 6 th Edition.

Place a Relationship Using Existing ColumnsThe fk_EMPLOYEE_DEPARTMENT Foreign

Key Properties

KROENKE and AUER - DATABASE CONCEPTS (6th Edition) Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall

C-50

Figure C-34:The fk_EMPLOYEE_DEPARTMENT Foreign Key Properties

Page 51: Getting Started with Oracle MySQL 5.5 Community Server Edition Appendix C DAVID M. KROENKE and DAVID J. AUER DATABASE CONCEPTS, 6 th Edition.

The CompletedDEPARTMENT, EMPLOYEE and PROJECT

Relationships

KROENKE and AUER - DATABASE CONCEPTS (6th Edition) Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall

C-51

Figure C-35:The Completed DEPARTMENT, EMPLOYEE and PROJECT Relationships

Page 52: Getting Started with Oracle MySQL 5.5 Community Server Edition Appendix C DAVID M. KROENKE and DAVID J. AUER DATABASE CONCEPTS, 6 th Edition.

MySQL WorkbenchN:M Relationships

KROENKE and AUER - DATABASE CONCEPTS (6th Edition) Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall

• An N:M relationship only exists in a data model (as a non-identifying relationship between two strong entities.

• In a database design, the N:M relationship becomes two 1:N ID-dependent identifying relationships linking the two original tables through a new, third table called an intersection table.

• MySQL Workbench only builds database designs and automatically creates the intersection table with the two 1:N relationships whenever we specify an N:M relationship.

C-52

Page 53: Getting Started with Oracle MySQL 5.5 Community Server Edition Appendix C DAVID M. KROENKE and DAVID J. AUER DATABASE CONCEPTS, 6 th Edition.

The Completed Set of Relationships

KROENKE and AUER - DATABASE CONCEPTS (6th Edition) Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall

C-53

Figure C-36: The Completed Set of Relationships

Page 54: Getting Started with Oracle MySQL 5.5 Community Server Edition Appendix C DAVID M. KROENKE and DAVID J. AUER DATABASE CONCEPTS, 6 th Edition.

The Completed E-R Diagram

KROENKE and AUER - DATABASE CONCEPTS (6th Edition) Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall

C-54

Figure C-37: The Completed E-R Diagram

Page 55: Getting Started with Oracle MySQL 5.5 Community Server Edition Appendix C DAVID M. KROENKE and DAVID J. AUER DATABASE CONCEPTS, 6 th Edition.

Getting Started withOracle MySQL 5.5 Community Server Edition

End of Presentation on Appendix C

DAVID M. KROENKE and DAVID J. AUER

DATABASE CONCEPTS, 6th Edition