Avatar of Johny Bravo
Johny Bravo
 asked on

Help with database

Hello Experts,

I am designing a database. Need your view on tables.

1. SuperAdmin
SuperAdminId
Pwd

2.Admin
AdminId
Pwd


Now I need to create a table "Events"
3.Events
EventId
EventName
Description
FromDate
ToDate
CreatedOn
CreatedBy

I am having confusion for "CreatedBy" in "Events".
Event can be created by Admin or SuperAdmin.
Then if I put their id in "createdby", thenlater how can I know which id refers to which table.
Your help is really appreciated. Thanks
Microsoft SQL ServerMicrosoft SQL Server 2005Microsoft SQL Server 2008

Avatar of undefined
Last Comment
Johny Bravo

8/22/2022 - Mon
ButlerTechnology

You could combine the SuperAdmin and admin table together.

AdminID
AdminName
AdminPassword
AdminRole (Regular or Super)
Jim Horn

In most databases I've seen it is not necessary to have a separate table for 'Admin' and 'SuperAdmin' for a column whose sole purpose is auditing, i.e. tracking who did what.  Normally I just seen the network ID (jhorn, sjobs, sclaus, ebunny, etc.) in the 'Created By' column.

Also, an argument can be made that Admin and SuperAdmin should really be one table, with a column (bit, maybe char(1)) that designates their role (Admin, SuperAdmin, Tourist, Data Entry, Reports Only, Don't Trust Me, etc.)

Hope this helps.
Jim
Johny Bravo

ASKER
Thank you Experts for your comments.
Current scenario is that, SuperAdmin creates Admin users for particular "Society"
Table :
1.Society
SocietyId
Name
Address


2.SocietyMembers
SMID
Name
Pwd
IsAdmin

Then how will the table be formed?
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy
Jim Horn

>Current scenario is that, SuperAdmin creates Admin users for particular "Society"
For starters, I don't see an CreatedBy column in the Society table, to identify who created it.

Also, it's better to spell out all requirements in the original question, instead of giving additional requirements with follow-on comments, so if you could frame up all of your needs and spell them out in one comment, we'd appreciate it.
ASKER CERTIFIED SOLUTION
ButlerTechnology

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Johny Bravo

ASKER
Hi Jim Horn,
I will keep in mind this point onward.
Johny Bravo

ASKER
Thank you both experts who have shared their views on this issue.
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.