Link to home
Start Free TrialLog in
Avatar of Joel Brown
Joel BrownFlag for United States of America

asked on

SQL Database Schema

I've worked with MS SQL on and off for a number of years and can do most of the basic things without any formal training.  I'm currently working with a rather large database with 50+ tables and views .....

The problem I always struggle with is how the tables associate with each other etc; and have to try things through trial and error .....

Many of the tables have fields in them and a predetermined set of values set in those fields but I'm not always sure what they mean.

I have the schema provided by the vendor for each of the tables and fields but I'm thinking their has to be more.

Again I'm not an expert by any means just thinking I'm missing something and thought I should ask.

Appreciate any help you might be able to give ......  

Thanks ...

Joel
Avatar of David Todd
David Todd
Flag of New Zealand image

Hi,

It depends if your vendor has defined any foreign key constraints.

What a foreign key constraint is saying is that the values in this column in this table must match those from the key column in a foreign table. This means that your table to the foreign table has a many to one relationship. Now that might actually end up as a one to one, but this table is the many ...

Can you post the schema?

HTH
  David
ASKER CERTIFIED SOLUTION
Avatar of Mike McCracken
Mike McCracken

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hi,

I suggest that mlmcc's first query example should have read

SELECT Customer.Name, Address.Street
FROM Customer LEFT OUTER JOIN Address
ON Customer.CustomerID = Address.CustomerID

Regards
  David
Avatar of Mike McCracken
Mike McCracken

Probably.  If you notice I used ADDRESSEE and not ADDRESS.

That was catering to the Address table being used for addresses of all types and not just customers.

mlmcc
Avatar of Joel Brown

ASKER

mlmcc ,  Would you be interested in chatting on the phone about this issue ?  Probably easier ..

Joel
Thanks everyone for your help .....   I beleive I have my questions answered ....  Much appreciated ...

Joel