Reputation: 155
I know there are many queries related to this question but my problem is different.I want to make a Password Manager application which stores host name,username,password,notes etc for each user. I can not store these information in user's column as there are multiple rows for each user's data.
So is it right in my case to create a separate table for each user or I create a single table named "Host" and add all passwords there with foreign key "username" as primary key in this table.Whenever any query is executed it display only particular user's rows.
User Table:- id:username:email:password:security question:answer
Host Table:- username:s.no.:host name:host username:password:notes
Which approach would be more effective and if there an better alternative please let me know.I am posting my question first time after gaining a lot from this website so please excuse me for my bad grammar.
Upvotes: 3
Views: 1093
Reputation: 6910
Creating Tables for each user is a BAD approach. If your going to use Plan A it will create database OVER HEAD when increase in number of users.
Use Plan B
Host Table:-username:s.no.:host name:host username:password:notes
Upvotes: 1
Reputation: 29976
A correct approach would resemple something like this:
Users
------
id | username | email | encryptedpassword | security_question | encryptedsecurityanswer
Hosts
------
id | user_id | name | notes
Ceate a table for users and hosts. These tables are joined by the Users.id to Hosts.user_id relationship.
Upvotes: 4