Working with Relationships (Visual Database Tools)

You can create relationships between your tables to show how the columns in one table are linked to columns in another table.

In a relational database, relationships enable you to prevent redundant data. For example, if you are designing a database that will track information about books, you might have a table called titles that stores information about each book, such as the book's title, date of publication, and publisher. There is also information you might want to store about the publisher, such as the publisher's phone number, address, and zip code. If you were to store all of this information in the titles table, the publisher's phone number would be duplicated for each title that the publisher prints.

A better solution is to store the publisher information only once in a separate table, publishers. You would then put a pointer in the titles table that references an entry in the publisher table.

To make sure your data is not out of sync, you can enforce referential integrity between the titles and publishers tables. Referential integrity relationships help ensure information in one table matches information in another. For example, each title in the titles table must be associated with a specific publisher in the publishers table. A title cannot be added to the database for a publisher that does not exist in the database.

NoteNote

If the table is published for replication, you must make schema changes using the Transact-SQL statement ALTER TABLE or SQL Server Management Objects (SMO). When schema changes are made using the Table Designer or the Database Diagram Designer, it attempts to drop and recreate the table. You cannot drop published objects, therefore the schema change will fail.

For details about working with relationships, see the following topics.

Table Relationships (Visual Database Tools)

Provides a brief overview of relationships as a means to prevent redundant data.

Types of Table Relationships (Visual Database Tools)

Describes one-to-one, one-to-many, and many-to-many relationships.

Overview of Referential Integrity (Visual Database Tools)

Describes requirements for enforcing referential integrity and the effect this has on database users.

How to: Change Relationship Properties (Visual Database Tools)

Provides steps for changing properties for relationships.

How to: Create Relationships Between Tables (Visual Database Tools)

Create relationships between database tables in a database diagram.

How to: Delete Relationships (Visual Database Tools)

Provides steps for removing the relationship between two tables.

How to: Check Existing Data When Creating a Relationship (Visual Database Tools)

Provides steps for how to check existing data when creating a relationship.

How to: Show Relationship Properties (Visual Database Tools)

Provides steps for accessing properties for relationships.

Foreign Key Relationships Dialog Box (Visual Database Tools)

Describes the various options for creating and modifying foreign key relationships.

Community Additions

ADD
Show: