Post on 22-Jan-2018
transcript
MYSQL WORKBENCHINTRODUCING A CASE TOOL
ER MODELING
Entity Relationship
Attribute Cardinality
ENTITY
Animate
Inanimate
Any other…
ENTITY COLLECTION
• Collection of the same type of entities
• Analogous to the database tables
ENTITY – AN EXAMPLE
Teachers Students
Classes Subjects
ENTITY – ANOTHER EXAMPLE
Product Category
Customer Order
ATTRIBUTES
• Anything, that can give a meaning or value to an entity
• It can be an unique identifier
• Or a not too unique name
ATTRIBUTES - EXAMPLE
Product
Identifier
Price
NameCustomer
Shipping
addressE-mail
NameIdentifier
RELATIONSHIP
• Between entities, there can be relationships
RELATIONSHIP - EXAMPLE
placesCustomer Order
containsCategory Product
RELATIONSHIP – RECURSE EXAMPLE
contains
contains
Category
CARDINALITY
One-to-one
One-to-many
Many-to-many
The cardinality of the relationship
CARDINALITY – EXAMPLE - ONE-TO-ONE
CustomerShipping address
accepts product
11
CARDINALITY – EXAMPLE - ONE-TO-MANY
Category Productcontains0..N1
CARDINALITY – EXAMPLE - MANY-TO-MANY
Order Productcontains0..M0..N
CARDINALITY – EXAMPLE - MANY-TO-MANY M products
N orders
CASE
• Computer-aided software engineering
• Anything, that can aid software development
MYSQL WORKBENCH FUNCTIONALITY
Database
Design
Database Development
Database Administration
DATABASE DESIGN
Creating a database (schema)
DATABASE DESIGN
Az üres adatbázis(séma)• Diagramok• Táblák• Nézetek• Rutinok• Rutin csoportok
DATABASE DESIGN
• Adding table
• Analogous to an entity
collection
• We can place
• Layers
• Texts or comments
• Images
DATABASE DESIGN
• Database columns
• Defining types
• Defining other constraints
• Primary key
• Unique key
• Not null
• Auto increment
• Adding comments
DATABASE DESIGN
• Many-to-one kapcsolat
• Defining foreign key
DATABASE DESIGN
• Setting foreign key
• What happens in
the event of an
update,
• or a delete
DATABASE DESIGN
• Many-to-many
relationship
• It is possible with a new
database table
DATABASE DESIGN
• Connect the customers
to our model!
• It will be possible with a
one-to-many relation
DATABASE DESIGN
• Add more attributes!
DATABASE DESIGN
• More special kind of attributes can be
enumerations
• We can constrain the value to a predefined set
ENUM(‘processing’, ‘processed’)
FORWARD ENGINEERING
• We can generate database from an existing model
• It will generate all the properties defined in the model
FORWARD ENGINEERING
• We don’t have to generate everything• Lot of options to set
FORWARD ENGINEERING
• It saves us from a lots of coding!
FORWARD ENGINEERING
• And we don’t have to care about how to run the code!
DATABASE DEVELOPMENT
• Or, SQL Development
• It can aid us constructing SQL Queries
DATABASE DEVELOPMENT
DATABASE DEVELOPMENT
• The Customer table
contains
SELECT * FROM customer;
CHANGE MANAGEMENT
• The database changes during its lifecycle
• Executing changes can be painful!
CHANGE MANAGEMENT
• We want to add another field to an existing database table
After change
CHANGE MANAGEMENT
• Let us change our model!
• Choose synchronize
• The tool will look for the
existing model in the
database and generate the
necessary changes
REVERSE ENGINEERING
• Creating a model from an existing database
• Not complete, due to the lack of metadata like comments
THANK YOU FOR YOUR ATTENTION!
Sources and inspirations
• http://www.tutorialspoint.com/dbms/er_model_basic_concepts.htm
• https://netbeans.org/kb/docs/javaee/ecommerce/data-model.html
• http://creately.com/blog/diagrams/er-diagrams-tutorial/
• http://intranet.unab.edu.co/AdministracionNoticias/Archivos/mysql_wp_workbench_93073623.pdf
• https://www.mysql.com/products/workbench/