Jump to content

Database blueprint, please advise.


StroiX

Recommended Posts

 

As you can guess, I am new to database programming and desperately need advise.  I have three tables, "Account", "Admin" and "Report".  Table "Account" will be used to store the customers information at the time of sign-up. "Admin" will be used to store information of the few chosen admins that will have access to the information stored in "Report" via a web page.  "Report" table will be used to save the reports that will be submitted by users.  I am wanting to give user (submitting the report) the option to remain anonymous and was thinking, instead of having a unique user_id, maybe I should just have report_ids and the "Report" table will be used to store information about the user if they chose to provide it otherwise the report_id will be used to reference the report and anything else submitted by users (this model is what I am using right now).  Users will also pick a password to access their account, and then that "account" will become their "report id" therefore accessing only one report at a time, hence the user may have several "accounts" if more than one report is submitted.

 

If this is confusing please let me know so I can better explain, and please feel free to advise ANY change necessary to make this blueprint better and more efficient for future use.  I am in the very beginning state and would appreciate any feedback, especially on how to go about linking the tables, make what primary, etc...  Thank you.

 

blueprint.png

Link to comment
Share on other sites

One way to hack off your users would be to have them create a new account each time they submit a report

 

Id move the account-related items from your report table to the account table and put the account owning the report

in the report table as a foreign key.

 

[pre]

account                report

==============        =================

accountID (PK)--+      reportID  (PK)

company        +----- accountID (FK)

address                type

city                  status

state                  risk_level

zip                    anonymous

firstname              message

lastname

email

password   

[/pre]

 

You might also want a date_submitted in the report table.

 

(Thanks for an image instead of text so we can't just copy the column names)

Link to comment
Share on other sites

I appreciated the image :) It looks a lot better than text. This coming from a console junkie. Barand is just an oldie!

 

For tracking of anonymous submissions, I usually just create an Anonymous user and leave it at that. This way you can have proper database design (with FK's, etc)

Link to comment
Share on other sites

For tracking of anonymous submissions, I usually just create an Anonymous user and leave it at that. This way you can have proper database design (with FK's, etc)

 

it depends on whether a user is always anonymous, or not, or if you want to give users the option of sometimes submitting anonymous reports.

 

In the former case the anon flag would be in the user table, in the latter case it be in the report table

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.