课程: Programming Foundations: Databases
今天就学习课程吧!
今天就开通帐号,24,600 门业界名师课程任您挑!
One-to-one relationships
- There's another kind of relationship called one-to-one. This is not frequently used, because usually if there's only one row that associates with only one other row, it suggests that the two rows should just be one row and one table. Our database here doesn't have anything that needs a one-to-one relationship. But a real-world example of a one-to-one relationship involves security. We could separate our customers table into two tables, putting just the customers' name and ID in one table and their personal information in the other. Then we'd have a one-to-one relationship between the tables. We might choose to protect the customers' personal information, like their birthday or email address, from being viewed by our employees, while leaving their name and key available to use in other relationships, like printing place cards or looking up a reservation. We might also use a one-to-one relationship if we…