Optional relationship in SQL Server -- How to implement in SSMS Schema Designer -


i have 2 cases set 'optional' relationship inside 1 table or between 2 tables.

first:

enter image description here

i want set relation optional, in other words: there categories , subcategories in 1 table, subcategory column optional.

second:

enter image description here

here want make sure house cannot exist without member (mandatory relation), member can without house (optional relation).

i don't have experience microsoft sql server , don't have idea how can modify these relations.

here end result in oracle diagram:

enter image description here

if you're asking how can done in schema designer (db diagram) in sql management studio, it's easy:-

  1. right-click table in digram, choose 'table view' -> 'standard'

right-clicking table

  1. in 'allow nulls' column, set optional foreign keys 'allow nulls'

setting nullable in designer

  1. press ctl + s save updates schema.

additional details selected object in designer (column, table, fk etc.) available viewing properties window (usually in right of screen). example, here properties subcat column in example:

subcat properties


Comments

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -