One of the things that I spend a lot of time when i start some proyect is to understand the relationships of the database provided, and the results of update or delete some foreign key

what is your way of learn a database structure? maybe you draw on paper? or some software

closed as primarily opinion-based by LowlyDBA, Erik Darling, mustaccio, RDFozz, Mr.Brownstone Jan 5 '18 at 17:12

Many good questions generate some degree of opinion based on expert experience, but answers to this question will tend to be almost entirely based on opinions, rather than facts, references, or specific expertise. If this question can be reworded to fit the rules in the help center, please edit the question.


You can use "database Diagram" and add all tables to get a physical representation of the tables with PK and FK and some link between table but this is certainly not as detailed as you would like it to be.

If you don't have any dev documentation for those DB, that's still bether than nothing and with some manual work to check those link between tables, you can get something that is "workable".

Thank you


I use this to find all the possible joins in a new DB:

with WholeSchema as (
select st.name as tableName, sc.name as columnName from sys.tables st
inner join sys.columns sc on st.object_id = sc.object_id)

select * from WholeSchema s1
inner join WholeSchema s2 on s1.columnName = s2.columnName
where s1.tableName != s2.tableName

You will probably want to narrow it down with a where clause.

Not the answer you're looking for? Browse other questions tagged or ask your own question.