Hi

I'am doing an online cinema ticket reservation system

and i have face a problem with the database design

i have these entities: Movie, Branch, Hall, Seat, Admin and customer

there is a relationship between the admin and all other entities except the customer which is the admin can add or update info in these entities

as far as i know the relationship can be between two entities or three!!

how can i draw the relationship between the admin and the related entities??

Thanks in advance :)

Recommended Answers

All 8 Replies

When you say there is a relationship between the admin and the other entities, what do you mean?

They are allowed to edit as far as UPDATES, INSERTS, and DELETES or do you mean the admins are the owners of the movie hall? And just to be sure, hall means movie hall?

i would say to do it like this

admin -> hall -> branch -> movie -> seat -> customer

If the admin is just a list of people who can add, modify and delete records and is used only for database security/management purposes, then the admin entity would not have a relationship to the other entities in the diagram.

However, if you want to track, say, the admin who made the most recent change to a record in a database, then you could add an AdminID foreign key to each entity.

Lastly, as mentioned by dickersonka, if the admin actually owes or is responsible for a particular Hall, then you would have admin related directly to Hall.

I guess my real question is, are admins used simply to administer the database or are admins responsible for individual halls, branches, movies, etc. ?

When you say there is a relationship between the admin and the other entities, what do you mean?

They are allowed to edit as far as UPDATES, INSERTS, and DELETES or do you mean the admins are the owners of the movie hall? And just to be sure, hall means movie hall?

i would say to do it like this

admin -> hall -> branch -> movie -> seat -> customer

Thanks for your reply first

I mean that the admin can edit or update let's say the admin can add new movie or add new hall for example

The hall is the movie hall.

If the admin is just a list of people who can add, modify and delete records and is used only for database security/management purposes, then the admin entity would not have a relationship to the other entities in the diagram.

However, if you want to track, say, the admin who made the most recent change to a record in a database, then you could add an AdminID foreign key to each entity.

Lastly, as mentioned by dickersonka, if the admin actually owes or is responsible for a particular Hall, then you would have admin related directly to Hall.

I guess my real question is, are admins used simply to administer the database or are admins responsible for individual halls, branches, movies, etc. ?

Thanks for your reply

i want to keep track of the records edited by admins and thats the idea... i will have the admin Id as foreign key in the entities....

My question is here...should i create a single relationship which is edit or update and link all the related entities together???

or draw multiple relationships that have the same action which is edit or update between the admin entity and the other entities??

and as i said before....the admin is just the database adminstrator and there is no individual admin.

Thanks alot

and as i said before....the admin is just the database adminstrator and there is no individual admin.

hmmm, still not perfectly clear to me, maybe tim understands a little more

are you meaning admin is a database user(windows / sql user account) or there is a table you are wanting called admin that has user credentials for an administrator?

I not sure what you mean by this:

My question is here...should i create a single relationship which is edit or update and link all the related entities together???

or draw multiple relationships that have the same action which is edit or update between the admin entity and the other entities??

However, let me make a few comments and see if they help:

For databases I've used in the past, there is a text field in each of the tables called "Updated By". Each time a record is updated, the field is updated to show the name of the person who made the update.

I've also used databases that makes copies of all updated records in a separate table so you can see the history of all the updates that have been made.

Lastly, you can't control who can make updates to a database simply by adding an admin entity to the database and adding relationships; you will need to program the database to lookup the current user and see if they are in the admin table; if they are not, the database must be programmed to not allow the user to make the changes.

hmmm, still not perfectly clear to me, maybe tim understands a little more

are you meaning admin is a database user(windows / sql user account) or there is a table you are wanting called admin that has user credentials for an administrator?

the admin is one of the users of the system

i need his id as a foreign key in the related entites such as movie entity

so i must make a relation between the admin entity and the others

thanks for reply

I not sure what you mean by this:

However, let me make a few comments and see if they help:

For databases I've used in the past, there is a text field in each of the tables called "Updated By". Each time a record is updated, the field is updated to show the name of the person who made the update.

I've also used databases that makes copies of all updated records in a separate table so you can see the history of all the updates that have been made.

Lastly, you can't control who can make updates to a database simply by adding an admin entity to the database and adding relationships; you will need to program the database to lookup the current user and see if they are in the admin table; if they are not, the database must be programmed to not allow the user to make the changes.

Your comment is very useful and thanks alot for sharing with me

but as i said the admin is the system administrator his job to modify or add new movie details or new branch details...i need his id as a foriegn key in the other tables so it will be recorded with each updated record.
also this modifying in the database in a seprate page that cannot be viewed by other users


my question is in the ERD.....can i make more than three connection to one relationship.??

thanks for your replies :)

then just as tim said, add an AdminId column to each table that will be modified by that user and record this id as the user

these will have 1 to many (admin can have multiple relationships to hall, branch, movie)
(1..x)
admin ------> hall
admin ------> branch
admin ------> movie

hall -> branch -> movie -> seat -> customer

then we will have the same structure as before

my question is in the ERD.....can i make more than three connection to one relationship.??

Each entity (table) in an ERD can have more than one connection (i.e., be related to more than one entity)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.