# [[Primary key]] ![[Primary key.svg]] In [[Database|Databases]], a primary key is a unique identifier for a database record. This is most often a number so that it can be easily incremented while maintaining uniqueness, but strings (like filenames) could be used as primary keys as well. In the `CUSTOMERS` table below, the `CustomerID` field is the most ideal primary key. | CustomerID | Name | Address | Telephone Number | | ---------- | ------------ | ------------------------------------- | ----------------- | | 1 | John Doe | 123 Main St, London, UK | +44 20 7946 0958 | | 2 | Jane Smith | 456 Elm St, Toronto, Canada | +1 416 555 1234 | | 3 | Bob Johnson | 789 Oak St, Sydney, Australia | +61 2 9876 5432 | | 4 | Alice Brown | 101 Pine St, Berlin, Germany | +49 30 1234 5678 | | 5 | Charlie Lee | 222 Birch St, Tokyo, Japan | +81 3 5678 9012 | | 6 | David White | 333 Cedar St, São Paulo, Brazil | +55 11 99876 5432 | | 7 | Emily Clark | 444 Aspen St, Cape Town, South Africa | +27 21 345 6789 | | 8 | Frank Adams | 555 Walnut St, Paris, France | +33 1 2345 6789 | | 9 | Grace Miller | 666 Maple St, New Delhi, India | +91 11 9876 5432 | | 10 | Henry Wilson | 777 Cherry St, Auckland, New Zealand | +64 9 876 5432 | When a primary key of one table is referred to in another table, it is called a [[Foreign key]]. %% # Excalidraw Data ## Text Elements ## Drawing ```json { "type": "excalidraw", "version": 2, "source": "https://github.com/zsviczian/obsidian-excalidraw-plugin/releases/tag/2.1.4", "elements": [ { "id": "4y8R7iOA", "type": "text", "x": 118.49495565891266, "y": -333.44393157958984, "width": 3.8599853515625, "height": 24, "angle": 0, "strokeColor": "#1e1e1e", "backgroundColor": "transparent", "fillStyle": "solid", "strokeWidth": 2, "strokeStyle": "solid", "roughness": 1, "opacity": 100, "groupIds": [], "frameId": null, "roundness": null, "seed": 967149026, "version": 2, "versionNonce": 939059582, "isDeleted": true, "boundElements": null, "updated": 1713723615080, "link": null, "locked": false, "text": "", "rawText": "", "fontSize": 20, "fontFamily": 4, "textAlign": "left", "verticalAlign": "top", "containerId": null, "originalText": "", "lineHeight": 1.2 } ], "appState": { "theme": "dark", "viewBackgroundColor": "#ffffff", "currentItemStrokeColor": "#1e1e1e", "currentItemBackgroundColor": "transparent", "currentItemFillStyle": "solid", "currentItemStrokeWidth": 2, "currentItemStrokeStyle": "solid", "currentItemRoughness": 1, "currentItemOpacity": 100, "currentItemFontFamily": 4, "currentItemFontSize": 20, "currentItemTextAlign": "left", "currentItemStartArrowhead": null, "currentItemEndArrowhead": "arrow", "scrollX": 583.2388916015625, "scrollY": 573.6323852539062, "zoom": { "value": 1 }, "currentItemRoundness": "round", "gridSize": null, "gridColor": { "Bold": "#C9C9C9FF", "Regular": "#EDEDEDFF" }, "currentStrokeOptions": null, "previousGridSize": null, "frameRendering": { "enabled": true, "clip": true, "name": true, "outline": true } }, "files": {} } ``` %%