Dataford
Popular roles
Software EngineerData AnalystData ScientistData EngineerBusiness AnalystAI EngineerMachine Learning EngineerProduct Manager
Browse
Browse All RolesEvery role hub, from analyst to MLBrowse All CompaniesCompany-specific interview loopsAll Interview GuidesThe full guide library
Top questions by role
Software EngineerData AnalystData ScientistData EngineerBusiness AnalystAI EngineerMachine Learning EngineerProduct Manager
Top questions by skill
SQLPythonStatisticsMachine LearningA/B TestingSystem DesignGenerative AIProduct SenseMetricsBehavioral
Browse all questions →Try a mock interview
ExperiencesCoaching
New
Practice
Mock InterviewsTimed interview simulations with feedbackSuccess PathYour 6-week structured planModulesCurated lessons by topicWebinarsTalks from ex-Big Tech data leadsPlaygroundA free-form scratch editor
Learn
BlogInterview strategy and career adviceTech Job Market ReportHiring trends across data and AI rolesFor UniversitiesDataford for career centersAbout DatafordWho we are and how we build
Pricing
Get started
Normalization Rules and Dependencies from 1NF to 5NF
00:00
5 left

Normalization Rules and Dependencies from 1NF to 5NF

MediumSQL · PostgreSQL

Problem

Explain the different normal forms in a DBMS.

Discuss the purpose of normalization, the conditions for 1NF, 2NF, 3NF, BCNF, 4NF, and 5NF, and the anomalies each form helps prevent. For grading, return the normal forms in order with their defining rule and an associated dependency rule.

Output

  1. One row per normal form
  2. Columns: normal_form, definition, dependency_rule
  3. Sort by normal form progression from 1NF through 5NF

Output details

  • Include every form with sort_order <= 5, including forms without matching rules and forms having multiple rules.
  • Represent a missing dependency_rule as null.
  • Sort ascending by sort_order, then ascending by rule_id.
  • Retain duplicate normal-form rows rather than deduplicating them.
  • Return all qualifying rows without a row limit.

Schema

normal_forms
ColumnTypeDescription
normal_form_codePKVARCHAR(10)Short identifier for the normal form
form_nameVARCHAR(50)Display name of the normal form
definitionTEXTDefining condition for the normal form
sort_orderINTLogical progression order
normal_form_rules
ColumnTypeDescription
rule_idPKINTUnique dependency rule identifier
normal_form_codeVARCHAR(10)Referenced normal form
dependency_typeVARCHAR(80)Type of dependency addressed
rule_textTEXTExplanation of the dependency rule
Tablesnormal_formsnormal_form_rules
Interviewer

Whenever you're ready, walk me through your approach or go straight to the code. The requirements and the two tables are in the Question tab.

You need to log in / sign up to run or submit.
CodePostgreSQL
Sign up free to run your codeLog inLn 1
Run your query to see results here.