sql - Unique statements and FK -


i have answer question unique statements. in particolar, question ask me indicate maximum number of unique statements can define on relation of 5 columns. suppose number should 5^5. right? , question foreign keys ask me whether attribute relation r can foreign key referencing b in relation s, if not primary key r. think because fk constraint can include null values, attribute specified fk referencing pk on table shouldn't primary key itself. right? thank in advance!

the maximum number of distinct unique relationships can define 2^n - 1. basically, given column can in or out of relationship. "- 1" because cannot define unique relationship no columns.

for instance, 3 columns, can have:

  • a
  • b
  • c
  • a, b
  • a, c
  • b, c
  • a, b, c

if think of these binary numbers, see pattern:

  • 100
  • 010
  • 001
  • 110
  • 101
  • 011
  • 111

Comments

Popular posts from this blog

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project.Error occurred in starting fork -

windows - Debug iNetMgr.exe unhandle exception System.Management.Automation.CmdletInvocationException -

unity3d - Fatal error- Monodevelop-Unity failed to start -