I created a test database with 3 tables which is viewable in the screenshot listed above:
CUSTOMERS
INVOICES
EMPLOYEES
Sure a Customers to Invoices primary to foreign key relationship is obvious that it's a 1 to many to us, but how did MS-SQL know to create it as a 1 on the customers table to many on the invoices table?? It's not like SQL can think 'well jee 1 customer will want many invoices potentially so I'd better make it a 1 to many.'
Also, when you set a foreign key on a table, you have to have the same column name and type as the primary key, then SQL will always keep those columns in synch right?
In this case with the screenshot provided, do I only have to create a relationship between the 2 tables, can I also just create a primary key and create a foreign key from TransactSQL via command line, and if so, is that the same exact thing? Thanks and sorry for all the newb questions.