Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
First normal form
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
===Design that complies with 1NF=== Codd described how a database like this could be made less structurally complex and more flexible by transforming it into a relational database in first normal form. To normalize the table so it complies with first normal form, attributes with nonsimple domains must be extracted to separate, stand-alone relations. Each extracted relation gains a [[foreign key]] referencing the [[primary key]] of the relation which initially contained it. This process can be applied recursively to nonsimple domains nested in multiple levels (i.e., domains containing tables within tables within tables, and so on).{{r|Codd 1970}}{{rp|pages=380–381}} In this example, CustomerID is the primary key of the containing relation and will therefore be appended as a foreign key to the new relation: {{Col-float}} {{Col-float-break|style=margin-right: 20px;}} {{Table alignment}} {| class="wikitable col1right" |+ Customer ! <u>CustomerID</u> !! Name |- | 1 || Abraham |- | 2 || Isaac |- | 3 || Jacob |} {{Col-float-break}} {{Table alignment}} {| class="wikitable col1right col2right col4right" |+ Transaction ! <u>CustomerID</u> !! <u>TransactionID</u> !! Date !! Amount |- | 1 || 12890 || 2003-10-14 || −87 |- | 1 || 12904 || 2003-10-15 || −50 |- | 2 || 12898 || 2003-10-14 || −21 |- | 3 || 12907 || 2003-10-15 || −18 |- | 3 || 14920 || 2003-11-20 || −70 |- | 3 || 15003 || 2003-11-27 || −60 |} {{Col-float-end}} In this modified design, the primary key is {CustomerID} in the first relation and {CustomerID, TransactionID} in the second relation. Now that a single, "top-level" relation contains all transactions, it will be simpler to run queries on the database. To find the monetary sum of all October transactions, the DMBS would simply find all rows with a Date falling in October and sum the Amount fields. All values are now easily exposed to the DBMS, whereas previously some values were embedded in lower-level structures that had to be handled specially. Accordingly, the normalized design lends itself well to general-purpose query processing, whereas the unnormalized design does not. It is worth noting that the revised design also meets the additional requirements for [[second normal form|second]] and [[third normal form]].
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)