Creating the ER Model after the creation fo the database - database

I've created a program runnning on the web (html) about booking tickets on a cinema theater.
I now want to create its ER Model.
As far as I know, the logical sequence of actions is:
Create the ER Model
Generate the Physical Model
Create your Database
So now, when I try to create the ER model, the relation between my entities doesn't seem right. On the other hand, if I add more entities like customer or admin, then that means that I have created more tables for my database that I don't need.
Anyone can help me in this one?

Related

EDR M:N relationship with multiple dependencies

I am in process of designing a reporting tool. the Interface will be C# with backend database. The tool will allow to enter and edit data through an interface and save it to the Database. Additionally, it will provide specific reports, based on the data retrieved from DB.
Currently, I have been trying to solve a M:N relationship in for my DB tables.
The tool lets a user to enter daily Item amounts (Steel and Mesh) based on a Project. I have solved the M:N relationship in the following diagram but I am not sure if this is actually possible and whether I need to break down the daily stats table further, due to a composite key containing 4 PKs from other tables. This is the current diagram i got.
I am wondering whether the diagram has solved the M:N relationship correctly and whether there is a better way to utilise the date table.

3-Way Relation or Relation with Relation in Laravel?

I'm puzzling over how to set up this relationship in Laravel, (I'm converting a legacy app):
I have Repair Shops, which provide different types of repairs, on different brands of vehicles.
For example, Shop A might repair Brakes but not Exhaust Systems for Ford vehicles. Shops are required to say what services they provide, (Exhaust repair), but adding a brand is optional. I have Shop, Service, and Brand tables in the DB. Shop and Service have a belongsToMany relationship using the provides_service pivot table. In the legacy system I have a 3-way pivot table to specify what Services can be done to each Brand in each Shop.
Laravel doesn't seem to do 3-way relationships well, (or does it? If so, point me there!). So, I feel like it would make sense to create a belongsToMany between the provides_service relation and the Brand. So, is there a way to set up a relationship between a Model and another Relationship in Laravel, or do I have to create a ProvidesService model? Creating a ProvidesService model seems wasteful, but I'm not sure what else to do here.

How to avoid repeated information in multiple tables

First of all, sorry for my english, is not my native language.
Well, I have a problem with my database design, I mean:
I have a Java Web Application (using JSP, Servlets, Classes and Mysql RDBMS) and I have been storing data about properties and it's owners mainly (there are others entities but those are the important here).
Now, I need to create a new module to store data about events, something like this:
Event: name, location, date, topic, etc.
Participants: Identification, name,location, type of participant (speaker or assistant)
I've been thinking in my database design and most of the assistants are already stored in the Owner entity, but other donĀ“t.
The problem is:
If I create an assistant entity, I'm going to repeat the same data which is alreade stored in Owner Entity (for those assistants that are already created as owners). So, if later I need to store data about surveyers or sales person or whatever, I'm going to have the same data in different tables.
I was thinking on create a Person Entity, and use it to store the properties that are common between assistants and Owners (even for my user table) but I have read about inheritance in a database and people say it's not a good practice for database design purposes.
How can I solve this problem?
What's the best practice in this case?

Creating an entity relationship diagram

I've created this ERD:
But now I want to add some more information to my diagram, but I do not how I should do that.
I want to modify my previous ERD, I need to register what recipe was made by what chef in each program. Also, I want to identify what ingredient and tool were used in each step of the recipe.
I think implementing your Entity Relationship Diagram into Microsoft Access can be a good start. You've clearly defined the relations between each entity and have declared attributes for each entity. I would say that you first make each entity into a table in MS Access then add the fields and set up the relationships and see how the work together.
Make sure that your relationships are working before you start filling the database with records.

How to visualize relation between objects in a database?

I have a database which I want to visualize in some kind of tool. Let me explain the basic:
Company A does business with Transport Company A and Transport Company B.
Transport Company A does business with Company A, Company B and Company C.
Company C does business with Transport Company A and Transport Company B.
As you can see every Company does business with different Transport Companies and vice versa. These relationships can be implemented in a database, and when drawing a visual model on paper this is also very easy.
Of course the model should contain hundreds of Companies and Transport Companies. So I want to have a visualizing tool, where a overview of these relations can be displayed.
My question is which tools can be used for realizing this?
I think you want to look at Microsoft Visio (get the 2010 version. 2013 is almost unusable from a database standpoint).
But if i am assuming correctly, you want to create a table per company. Don't do this! this can cause redundancy and data integrity problems. you want to create just one table and create what is called a unary many-to-many relationship. This is relationship that can be translated to many different rows can relate to many rows in the same table. I won't go into more detail unless you want me to, as i spent a week or 2 in my Database Design course last month just on many-to-many relationships and gets kinda complicated.

Resources