I am working about a very hudge PostgreSQL database.
The database have more hundred relations between table. But I want to link two tables named "client" and "services" (in order to quering these tables) but I don't know what relations take to link them.
I can't install tools to do this. I can only use the command-line interface.
Are there a way to do that ?
EDIT : This question is not duplicate because I never ask the relation presents in a table.
I want a way to map (get all tables) between two tables. These two tables don't have a common relation because they are distant from many tables in the database.
Related
I desperately need your help. I have database tables IN POSTGRESQL which I need to create an ER Model for them. My challenge is creating relationships among the tables. I know this might be alot of work but I just need help on creating relationships among the tables, what column names should I use and all that . Here is an image of the tables in the database
I created an entity-relationship diagram (logical model) and engineered it to a relational model.
The tables were generated. Now I need to use them from the connection XE as you see in the picture.
The tables I made can only be seen on the data modeler design view in the "Browser", how do I get them on the connection "XE" to generate data dictionary, etc?
There are three possibilities:
you just need to expand the tables item in the tree to see your tables
You are looking in the wrong schema/user - go down to Other Users, and find the schema those tables belong to
The tables do not exist in the current database
If #3 is the issue, you would need to create them, possibly using the information in your Data Model - that is, you can generate the DDL/SQL scripts for those tables.
Then taking those scripts, run them while connected to the appropriate database/schema.
Disclaimer: I'm an Oracle employee and the product manager for these tools.
I am following a SQL tutorial, it states
Database administrators often use relationship diagrams to help demonstrate how database tables are connected.
However,I tried every corner of mysql workbench but failed to find such a well-organized diagram.
How could I see the database structure as the diagram shows?
Looks like you didn't find the modeling part of MySQL Workbench yet. Walk through the tutorials to reverse engineer a schema and create an EER model from it.
You can customize colors and figure sizes + positions, organize a diagram with layers for better overview and change the notation (crow food etc.). Search for modeling with MySQL Workbench for more tips.
I learned long time ago database structure. But as I see on your picture, the diagram shows columns of tables and the relations between them.
1:N - means from the other table allowed to reference more than 1 records
1:1 - means from the other table allowed to reference only one record.
Example: relation between customers and orders.
The orders can have many customers_id and same customers as well. Because one customer can send more order.
You can find customer_id in order table too.
I have some tables which should add to my database every year and name of databases contains the year (like sell2005) and iv'e written some ef queries on these tables ,and queries can only be on a single entity (like sell2005) but what should i do when sell2006 or sell2007 add ? how can i manage them with that single query which iv'e written before?
thank you.
There is no easy way. EF is simply not tool for this scenario. For EF you must have "single table" so you must either use partitioning with one real database table partitioned by year or you must build a view on top of these tables.
The problem is that in EF you have strict relation between classes and tables. You cannot have single class mapped to multiple tables even if they are exactly same (except inheritance which is not solution for you). So the workaround would require to have multiple SSDL/MSL mappings - one for each table and construct correct context instance with correct mapping for every query. As I know dynamic changes of mapping are not possible (except modifying SSDL/MSL files before using them).
When use entity framework for DAL tier, VS 2010 can create edmx for each database.
Question:
If I have a database with many tables, should I create only one edmx for all tables or mutiple edmx files? for example, maybe all security tables for one edmx file, other tables for another edmx file. If there is more than one, then in other tiers, there will have more then on ObjectContext in code for business logic.
Which one it the best solution for this case?
I've done this before when experimenting with AdventureWorks. If you have a large database with lots of tables, and the tables are segmented into separate schemas (like the Purchasing, Sales, HumanResources schemas in AdventureWorks) then it may work well to create multiple models. They don't have to be separate schemas- any two groups of related tables where there are no relations between the groups would work.
You'd want to make sure that you include all related tables in each model so that you don't have to try to join entities across models.