Skip to content

Commit 50c23f9

Browse files
improve flow in Normalization
1 parent 39b9008 commit 50c23f9

File tree

1 file changed

+26
-26
lines changed

1 file changed

+26
-26
lines changed

book/30-schema-design/055-normalization.ipynb

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -292,32 +292,6 @@
292292
"This workflow-centric view fundamentally shapes normalization principles and explains why DataJoint emphasizes immutability and avoidance of updates.\n"
293293
]
294294
},
295-
{
296-
"cell_type": "markdown",
297-
"metadata": {},
298-
"source": [
299-
"## Practical Example: Animal Research Lab\n",
300-
"\n",
301-
"Let's apply these principles to design a schema for tracking mice in a research lab.\n",
302-
"\n",
303-
"### ❌ Poor Design (Violates Normalization)\n",
304-
"\n",
305-
"```python\n",
306-
"@schema\n",
307-
"class Mouse(dj.Manual):\n",
308-
" definition = \"\"\"\n",
309-
" mouse_id : int\n",
310-
" ---\n",
311-
" date_of_birth : date # ✓ Permanent property of mouse\n",
312-
" sex : enum('M', 'F') # ✓ Permanent property of mouse\n",
313-
" cage_id : int # ✗ CHANGEABLE - violates Rule 3\n",
314-
" current_weight : decimal(5,2) # ✗ CHANGEABLE - violates Rule 3\n",
315-
" cage_location : varchar(50) # ✗ Property of CAGE, not mouse - violates Rule 2\n",
316-
" cage_capacity : int # ✗ Property of CAGE, not mouse - violates Rule 2\n",
317-
" \"\"\"\n",
318-
"```"
319-
]
320-
},
321295
{
322296
"cell_type": "markdown",
323297
"metadata": {},
@@ -623,6 +597,32 @@
623597
"**UPDATE exists** for the rare cases when data corruption or entry errors must be corrected surgically. It's a maintenance tool, not an operational tool.\n"
624598
]
625599
},
600+
{
601+
"cell_type": "markdown",
602+
"metadata": {},
603+
"source": [
604+
"## Practical Example: Animal Research Lab\n",
605+
"\n",
606+
"Let's apply these principles to design a schema for tracking mice in a research lab.\n",
607+
"\n",
608+
"### ❌ Poor Design (Violates Normalization)\n",
609+
"\n",
610+
"```python\n",
611+
"@schema\n",
612+
"class Mouse(dj.Manual):\n",
613+
" definition = \"\"\"\n",
614+
" mouse_id : int\n",
615+
" ---\n",
616+
" date_of_birth : date # ✓ Permanent property of mouse\n",
617+
" sex : enum('M', 'F') # ✓ Permanent property of mouse\n",
618+
" cage_id : int # ✗ CHANGEABLE - violates Rule 3\n",
619+
" current_weight : decimal(5,2) # ✗ CHANGEABLE - violates Rule 3\n",
620+
" cage_location : varchar(50) # ✗ Property of CAGE, not mouse - violates Rule 2\n",
621+
" cage_capacity : int # ✗ Property of CAGE, not mouse - violates Rule 2\n",
622+
" \"\"\"\n",
623+
"```"
624+
]
625+
},
626626
{
627627
"cell_type": "markdown",
628628
"metadata": {},

0 commit comments

Comments
 (0)