Is it possible to use a composite foreign key as a piece of a table’s composite primary key? For instance, let’s say I have two tables: … and then in a second table, I would like to reference the foreign key in the second table’s primary key: Is there any way that I can do that? Yes, it might be
Tag: foreign-keys
PostgreSQL: SQL script to get a list of all tables that have a particular column as foreign key
I’m using PostgreSQL and I’m trying to list all the tables that have a particular column from a table as a foreign-key/reference. Can this be done? I’m sure this information is stored somewhere in information_schema but I have no idea how to start querying it. Answer This uses the full catalog/schema/name triplet to identify a db table from all 3
Is there a severe performance hit for using Foreign Keys in SQL Server?
I’m trying my best to persuade my boss into letting us use foreign keys in our databases – so far without luck. He claims it costs a significant amount of performance, and says we’ll just have jobs to cleanup the invalid references now and then. Obviously this doesn’t work in practice, and the database is flooded with invalid references. Does
How to create relationships in MySQL
In class, we are all ‘studying’ databases, and everyone is using Access. Bored with this, I am trying to do what the rest of the class is doing, but with raw SQL commands with MySQL instead of using Access. I have managed to create databases and tables, but now how do I make a relationship between two tables? If I
Moving from ints to GUIDs as primary keys
I use several referenced tables with integer primary keys. Now I want to change ints to GUIDs leaving all references intact. What is the easiest way to do it? Thank you! Addition I do understand …