Database Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsDatabasesDatabase Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old January 24th, 2009, 10:32 PM
noob2sql noob2sql is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2009
Posts: 2 noob2sql User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 34 m 58 sec
Reputation Power: 0
Help with db design

I am trying to self learn sql and databases by small projects around the office. I want to have a database to keep track of accounts and passwords for different machines. The data will be:
machine name
account name on a machine
password for a particular account on a specific machine
and who will have access to a specific password to a specific account on a specific machine.

I have 4 tables, user, machine, account, & password. each table has a primary key which is an integer and the data, i.e. machinename, id1. I understand about queries pulling data from each table, but am lost trying to put everything together.

Am I on the right path for something like this or are the tables wrong? Any ideas are appreciated..

noob2sql

Reply With Quote
  #2  
Old January 29th, 2009, 01:00 AM
dykebert's Avatar
dykebert dykebert is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2008
Posts: 408 dykebert User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 Days 20 h 27 m 28 sec
Reputation Power: 2
OK you've got the basics.

Start with the table that are unique and that stand alone.

these are Machine and User

tblMachine
Machine_ID (PK)
Machine_Name
....

tblUser
User_ID (PK)
User_FirstName
User_LastName
....

Now let's take a look a the rest of the tables you need.

A Machine can have multiple Accounts (this is called a one-to-Many relationship; One machine - Many accounts) The typical way of building this is like so:

tblAccount
Account_ID (PK)
Machine_ID (FK)
Account_Name
Account_Password

Next is the fact that an Account can have multiple Users and a User can use multiple Accounts. (this is call a Many-to-Many relationship) the typical way to build this is with an association table like so:

tblUserAccountAssociation
Association_ID (PK)
User_ID (FK)
Account_ID (FK)


(PK) mean this field is the Primary Key for the table.
(FK) means this field is the Primary Key in another table. It is considered a Foreign Key (Imported) in this table.

Hopefully this makes sense.

Have fun!
__________________
P.S. I am looking for work. <grin>.

Reply With Quote
  #3  
Old January 31st, 2009, 03:55 PM
noob2sql noob2sql is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2009
Posts: 2 noob2sql User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 34 m 58 sec
Reputation Power: 0
Thumbs up

Excellent, thanks for the info. I was able to create the tables from your design and populate with some small data. The query I wrote does exactly what I needed it to do with equi-joins. The key was the UserAccountAssociation table. The data input there ties the user with an account which is also ties to a machine name. So far with just a little test data it seems a lot of work, but I imagine when the data gets larger, the benefits of using a db will be large.

I can't tell you how long I have racked my brain on this, but to see the correct data returned from the query - I am thrilled at the outcome

Thanks again for the help!!!

Reply With Quote
  #4  
Old February 2nd, 2009, 02:30 AM
dykebert's Avatar
dykebert dykebert is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2008
Posts: 408 dykebert User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 Days 20 h 27 m 28 sec
Reputation Power: 2
One more thing. This design assumes that most of the accounts will be machine specific. If you have an account that is used for multiple machines then you will have to creates account records for each machine. This isn't a big issue if there are only a few of duplicate accounts. You just need to remember that if you need to change one you'll need to change all.

Now if about 50% of the accounts are shared across machines then you have a Many to Many to Many (Accounts, Machine, users). There are a couple of ways of doing this and it depends a bit on what you will accessing it all the time. However one solution is the following:

tblAccount
Account_ID
AccountName
AccountPassword

tblMachineAccountUser
Assoc_ID
Machine_ID
Account_ID
User_ID

I don't know that you have this situation, but I figured I'd mention it.

Have fun!

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsDatabasesDatabase Development > Help with db design


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump




 Free IT White Papers!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

Request Your Free Technology Downloads!
 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

Request Your Free Technology Downloads!
 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

Request Your Free Technology Downloads!
 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

Request Your Free Technology Downloads!
 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

Request Your Free Technology Downloads!
 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 




© 2003-2009 by Developer Shed. All rights reserved. DS Cluster 4 Hosted by Hostway
Stay green...Green IT