Download Visual Database Creation with MySQL Workbench

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Serializability wikipedia , lookup

Relational algebra wikipedia , lookup

DBase wikipedia , lookup

IMDb wikipedia , lookup

Microsoft Access wikipedia , lookup

Oracle Database wikipedia , lookup

Entity–attribute–value model wikipedia , lookup

Functional Database Model wikipedia , lookup

Extensible Storage Engine wikipedia , lookup

Concurrency control wikipedia , lookup

Database wikipedia , lookup

Microsoft SQL Server wikipedia , lookup

Microsoft Jet Database Engine wikipedia , lookup

Open Database Connectivity wikipedia , lookup

Ingres (database) wikipedia , lookup

SQL wikipedia , lookup

Clusterpoint wikipedia , lookup

PL/SQL wikipedia , lookup

ContactPoint wikipedia , lookup

Relational model wikipedia , lookup

Database model wikipedia , lookup

Transcript
Visual Database Creation
with MySQL Workbench
도시정보시스템 설계
2012. 11
What is MySQL Workbench?
•
•
•
SQL Development: Replaces MySQL query browser. Allows the user to connect to an
existing database and edit and execute SQL queries
Data Modeling: Complete visual database design and modeling
Database Administration: Replaces MySQL administrator. Graphic interface to start/stop
servers, create user accounts, edit configuration files, etc.
Planning Database
•
•
•
•
•
•
•
•
•
•
One teacher can teach many
subjects
One subject can be taught by
many teachers
Each class has only one teacher
One teacher can teach many
classes
One student can attend many
classes
One class has many students
One class may have several hours
(in a week)
At one particular day and hour,
there may be several classes
A class is about one subject
One subject may be taught in
many classes
Launching Workbench
• Click Create new EER Model
Creating Tables
• Use Add Table icon, or EER Diagram
Go Visual
•
•
Select Model/Create Diagram from Catalog Objects  creates Tables
Click table icon to create a new table
Enter Column Details
Drawing Relationships
• A relationship is identifying when one table is
entirely dependent on the other to exist.
• For example, a separate table to store phones
for users. One user can have several phones but
each row in that table is entirely dependent on
the use – it belongs to the user
Relationships
• 1:1 relationships. Primary key for one of the
tables is included as foreign key in the other
table
• 1:n relationships. Primary key of the table in
the ’1′ side is added as foreign key in the table
in the ‘n’ side
• n:m relationships. A new table ( join table) is
created. The primary key is composed of the
primary keys from the two original tables
Drawing Relationships
• For one-to-many relationships, click on the “many” side table first,
the one the “one” side table
After entering relationships
Generating SQL
• Select File/Export/Forward Engineer SQL
CREATE Script
Review Generated Script
Connecting to a MySQL Server
• Select Database/Manage Connections
then New
Loading SQL Script
• Select Database/Query Database  SQL
editor opens
Database Generation
• Click the lightning icon to execute the
SQL script and database will be
generated
• Alternately, we can use
Database/Forward Engineer from the
menu to generate database