Create ERD for a mySQL DB by selecting only some of the main tables - mysql

I need to create an ERD for our DB system. As it happens, there are lots and lots of tables, and no one really understands much of it. What's more, the same DB has tables for different applications, so not all tables are relevant to my application. I need an ERD for only my application's tables.
I tried creating ERD from MySQL workbench. It allows me to select a subset of the tables to put on an ERD, but that's the problem: I don't know which tables to select ( One of the reasons to build the diagram in the first place :-) ).
What I do know are some of the 'main' tables involved. What I'm looking for is this: I tell the tool some 5-10 of these main tables I'm interested in, and the tool automatically picks up all the tables that are linked to these tables, and creates the ERD for them.
Any pointers?
Otherwise, I'll have to live with building my list of tables manaully, one by one...

http://www.fabforce.net/ has a nice tool called DBDesigner, I have used this in the past for some reverse engineering on a datamodel.

Related

MYSQL simple DB Design

Writing (.net) a simple app that logs whether a user has access to a program or not. Cannot figure out the best way to structure the DB/tables.
Interface will have two listboxes with buttons in between to add/remove items. What is the best way to layout the tables for easy querying?
Thanks (not a DB guy obviously!)
I recommend reading up on basic database design principles if you plan to continue working in this area.
https://en.wikipedia.org/wiki/Database_design
http://www.tomjewett.com/dbdesign/dbdesign.php?page=manymany.php
https://msdn.microsoft.com/en-us/library/office/aa200276(v=office.11).aspx
If I understand your question then a table of programs, a table of users, and a "many to many" table where each row contains an id from the user table and an id from the programs table if the user has access should suffice.

Can we make nested database in MySQL? If yes how?

I don't know if it has another term for it but I want to basically create a directorial database having different databases in one major database and each containing their respective tables. Is there any way to do that in MySQL?
Something like this:
No, it is not possible to make a nested database in MySQL.
MySQL supports a simple and flat structure. You cannot nest databases (and of course not tables, nor fields).
If you want to group databases together in MySQL for any reason (like availability), then you can use a common prefix when naming them. For example, if you want to develop an HRM (Human Resource Management System), and it has let's say 3 parts namely: Inventory, Attendance and Leaves, then you can have the following database:
HRM_INVENTORY (created by CREATE DATABASE HRM_INVENTORY;)
HRM_ATTENDANCE (created by CREATE DATABASE HRM_ATTENDANCE;)
HRM_LEAVES (created by CREATE DATABASE HRM_LEAVES;)
Now regarding the image that you have shared in your question, PHPMyAdmin only tries to find common prefixes and group them together to make them easy to find for the user. For example if you create the 3 databases I just mentioned, PHPMyAdmin will group them together under HRM and if you collapse it, you can see all the three.

How do I see part of EER diagram in mySQL workbench

I got a .mvb file from company, the relationship are complicated and Tables are a lot, I wonder how could I see the relationship between the tables piece by piece, to understand the relationship and database quickly.
Try this:
Model-diagram Properties
And then:
Arrange -autolayout

Adding tables via DAO to a database

As a general question which would really help me "connect the dots" with my studies.
I am currently doing exercises working with DAO and Learning how to add tables automatically. Although i have been working with databases for many years, i question, what type of scenerarios would it be vantagious to use this function. When is it necessary to add tables to a database in an automatic way? Up until now, in all my experiences the tables i need have Always been defined from the beginning and I cant think of a situation where I could of benefited from using this function. For example, i use frequently delete queries to help me clear tables and re-populate them, but when would it be necessary to actually "create" a new table"?
Yes, I have seen a scenario where new tables were created 'on the fly' (either via SQL create, or just DAO). With a shared database on a server, the application called for importing Excel data that a particular user was responsible for, so a table was created on the fly. Multiple users, changes in staff, need to keep data independent, etc. we could create their own table (name based on userid) that they had interfaces to do whatever they wanted with their own data. Not a typical scenario, but worked well for this application.

How to Map/Merge multiple tables?

I am new to SQL, I am trying to "map" data from several tables in ONE database to create ONE table with relational information. For example, I am trying to take data from my tables ps3_productcategories, ps3_categories and "map"/"merge" to the ps3_products table, The previous tables contains all the "category information" needed to map to "correct products".
I am trying to "MAP" the productID to the "correct"=> categoryID=> categoryName=> categoryParent etc.....
Any help would be appreciated
I suggest you look into views, it may be what you are looking for, although they do not create this in another database they do allow to create virtual tables from existing data.
A database View is known as a "virtual table" which allows you to query the data in it.
See the MySql manpage on views..
And here is a small tutorial on the subject.
If you really need this in a seperate database, you can easily create a view and export the results of that, and import it in other database.