# Database Normalization: 2nd Normal Form

This article follows on from [Database Normalization: 1st Normal Form](https://mariadb.com/docs/general-resources/database-theory/database-normalization/database-normalization-1st-normal-form).

After converting to first normal form, the following table structure was achieved:

| Plant location table |
| -------------------- |
| Location code        |
| Location name        |
| Plant code           |
| Plant name           |
| Soil category        |
| Soil description     |

Is this in 2nd normal form?

A table is in 2nd normal form if:

* it is in 1st normal form
* it includes no partial dependencies (where an attribute is only dependent on part of a primary key)

For an attribute to be only dependent on part of the primary key, the primary key must consist of more than one field. If the primary key contains only one field, the table is automatically in 2nd normal form if it is in 1st normal form

Let's examine all the fields. *Location name* is only dependent on *location code*. *Plant name*, *soil category*, and *soil description* are only dependent on *plant code* (this assumes that each plant only occurs in one soil type, which is the case in this example). So you remove each of these fields and place them in a separate table, with the key being that part of the original key on which they are dependent. For example, with *plant name*, the key is *plant code*. This leaves you with the tables below:

### Plant location table with partial dependencies removed

| Plant location table |
| -------------------- |
| Plant code           |
| Location code        |

### Table resulting from fields dependent on plant code

| Plant table      |
| ---------------- |
| Plant code       |
| Plant name       |
| Soil category    |
| Soil description |

### Table resulting from fields dependent on location code

| Location table |
| -------------- |
| Location code  |
| Location name  |

The resulting tables are now in 2nd normal form. The process for turning a table into 3rd normal form is continued in the next article.

<sub>*This page is licensed: CC BY-SA / Gnu FDL*</sub>

{% @marketo/form formId="4316" %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://mariadb.com/docs/general-resources/database-theory/database-normalization/database-normalization-2nd-normal-form.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
