Welcome to Dream.In.Code
Getting Help is Easy!

Join 118,589 Programmers for FREE! Ask your question and get quick answers from experts. There are 820 online right now! We've got more than 500 tutorials and 2,000 snippets. Join and find out why Dream.In.Code is the #1 programming help community on the internet! Registration is fast and FREE... Join Now!



DB Design / Table Relationships

 
Reply to this topicStart new topic

DB Design / Table Relationships

shortfor
post 22 Jul, 2008 - 02:12 PM
Post #1


New D.I.C Head

*
Joined: 17 Jul, 2008
Posts: 2


My Contributions


Hello all!

I am trying to design my first relational db using best practices (normalized). Any suggestions are greatly appreciated! This database manages properties, agents, and clients. This is what I have so far:

Table Offices:
OfficeID
Name
Address
Address2
City
State
Zip
MailingAddress
MailingAddress2
MailingCity
MailingState
MailingZip
Phone
Fax
TollFree
WebSite


Table Brokers:
BrokerID
OfficeID
FirstName
LastName
Title
DirectPhone
MobilePhone
Email
Fax


Table Brokers_Clients:
BrokerID
ClientID


Table Clients:
ClientID
ClientPassword
Email
FirstName
LastName
Phone


Table Brokers_Listings:
BrokerID
ListingID


Table Listings:
ListingID
ListingTypeID
StreetAddress
SuiteOrBuilding
Available
Parcel
MinAvailable
MaxAvailable
Divisible
ForSale
ForLease
SalePrice
SaleTerms


Table ListingTypes:
ListingTypeID
Title
Description


Does it look like I am on the right track? Thank you for any help!

This post has been edited by shortfor: 22 Jul, 2008 - 02:20 PM
User is offlineProfile CardPM

Go to the top of the page


programming4life
post 22 Jul, 2008 - 02:54 PM
Post #2


D.I.C Regular

Group Icon
Joined: 7 Feb, 2008
Posts: 399



Thanked 3 times

Dream Kudos: 50
My Contributions


from what i can see, this is a good db.
User is offlineProfile CardPM

Go to the top of the page

LockEngel
post 23 Jul, 2008 - 12:56 PM
Post #3


New D.I.C Head

*
Joined: 23 Jul, 2008
Posts: 12



Thanked 1 times
My Contributions


It looks fine to me, the only things I'd suggest altering are simply to make it easier to rember the order of things, or rather, place them in a more logical order.
But in the end it'll function the same anyway.

Example:

Table Brokers:
BrokerID
OfficeID
FirstName
LastName
Title
DirectPhone
MobilePhone
Email
Fax


Table Clients:
ClientID
ClientPassword
Email
FirstName
LastName
Phone


Title I would put before FirstName.
Simply because when we call up that data inside SQL itself the way you have it we'll get something like:
10001 100 John Doe Mr. 1234563456... etc.

Email and Phone I'd personally put these two next to eachother, since they're both contact information.
Once again, totally unnecissary, but I like to keep things organized.

So long story short, your layout seems fine.
tongue.gif icon_up.gif
User is offlineProfile CardPM

Go to the top of the page

programming4life
post 23 Jul, 2008 - 01:00 PM
Post #4


D.I.C Regular

Group Icon
Joined: 7 Feb, 2008
Posts: 399



Thanked 3 times

Dream Kudos: 50
My Contributions


@LockEngel It doesn't matter where in the table you list the items though. It is where they are located in the select statement, hence why most db's I've seen have the last name before the first name.
User is offlineProfile CardPM

Go to the top of the page

LockEngel
post 23 Jul, 2008 - 01:04 PM
Post #5


New D.I.C Head

*
Joined: 23 Jul, 2008
Posts: 12



Thanked 1 times
My Contributions


QUOTE(programming4life @ 23 Jul, 2008 - 01:00 PM) *

@LockEngel It doesn't matter where in the table you list the items though. It is where they are located in the select statement, hence why most db's I've seen have the last name before the first name.

I realise that, which is why I said its "totally unnecissary".
As I mentioned, its my personal preference, and also as I said "But in the end it'll function the same anyway"
wink2.gif
User is offlineProfile CardPM

Go to the top of the page

jjsaw5
post 23 Jul, 2008 - 07:18 PM
Post #6


D.I.C. Face

Group Icon
Joined: 4 Jan, 2008
Posts: 1,092



Thanked 5 times

Dream Kudos: 125

Expert In: HTML, CSS, Database,

My Contributions


Looks pretty good!
User is offlineProfile CardPM

Go to the top of the page

Fast ReplyReply to this topicStart new topic
Time is now: 10/11/08 07:47PM

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month