# Keys

## Incorrect

For effective use of Table Compare it is crucial to set the right columns as your keys.  The following table of sea ice thickness shows **inappropriate** keys and therefore poor alignment:

![Sea Ice Data, with incorrect keys in the column top](https://1446155253-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LXUX-uoaZJ8T4qyEc-x%2F-LnsE7ikVEd1sJEM0gyI%2F-LnsGWElW53lvMIVTkKc%2Fimage.png?alt=media\&token=17c412a0-285d-4b07-a25b-92c100ebd259)

## Correct

By rightclicking the column tops we set the keys to a more unique identifier.  In this case we chose *date* as the most unique key. In general, key columns should have values that are (somewhat) unique to a given row.  Key columns are often independent variables rather than dependant variables.  In the comparison below, date is the independant variable.

![Sea Ice Data.  Moving the key to column 2  gives improved alignment](https://1446155253-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LXUX-uoaZJ8T4qyEc-x%2F-LnsE7ikVEd1sJEM0gyI%2F-LnsGg3NXRq2ROq0WGR3%2Fimage.png?alt=media\&token=bcab89bd-1084-499f-811f-c887d3192f86)

Try it out yourself.  Start a Table Compare session by pressing ctl-T and then click Table Compare.  Or from the pulldown: `Session->NewSession->TableCompare`.  Then browse or use your mouse to drag and drip two Excel files. &#x20;

When the comparison loads, the rows might not align well. With the mouse, right click on your column tops to make them keys or not keys.&#x20;

Don't worry: nothing you do will change your Excel file: it is read-only in Beyond Compare. And if you don't like what you do to the columns, you can *undo* your settings with the button at `Rules->Columns->ResetAll`.

To investigate the subject of Key Columns, read about SQL and[ relational databases](https://en.wikipedia.org/wiki/Relational_database).


---

# 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://beyondcompare.gitbook.io/project/table-compare/keys.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.
