[{"data":1,"prerenderedAt":126},["ShallowReactive",2],{"term-p\u002Fprimary-key":3,"related-p\u002Fprimary-key":108},{"id":4,"title":5,"acronym":6,"body":7,"category":89,"description":90,"difficulty":91,"extension":92,"letter":16,"meta":93,"navigation":94,"path":95,"related":96,"seo":102,"sitemap":103,"stem":106,"subcategory":6,"__hash__":107},"terms\u002Fterms\u002Fp\u002Fprimary-key.md","Primary Key",null,{"type":8,"value":9,"toc":83},"minimark",[10,15,19,23,26,30,72,76,79],[11,12,14],"h2",{"id":13},"eli5-the-vibe-check","ELI5 — The Vibe Check",[16,17,18],"p",{},"A primary key is the unique ID that every row in a table must have. Like a social security number for your data — no two rows can have the same one. It is how the database knows exactly which row you mean when you say 'give me user 42'.",[11,20,22],{"id":21},"real-talk","Real Talk",[16,24,25],{},"A primary key is a column or set of columns that uniquely identifies each row in a table. It enforces the UNIQUE and NOT NULL constraints automatically. Every table should have a primary key. Common types are auto-incrementing integers (SERIAL) and UUIDs.",[11,27,29],{"id":28},"show-me-the-code","Show Me The Code",[31,32,37],"pre",{"className":33,"code":34,"language":35,"meta":36,"style":36},"language-sql shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","CREATE TABLE orders (\n  id SERIAL PRIMARY KEY,  -- auto-increments\n  user_id INT NOT NULL,\n  total DECIMAL(10,2)\n);\n","sql","",[38,39,40,48,54,60,66],"code",{"__ignoreMap":36},[41,42,45],"span",{"class":43,"line":44},"line",1,[41,46,47],{},"CREATE TABLE orders (\n",[41,49,51],{"class":43,"line":50},2,[41,52,53],{},"  id SERIAL PRIMARY KEY,  -- auto-increments\n",[41,55,57],{"class":43,"line":56},3,[41,58,59],{},"  user_id INT NOT NULL,\n",[41,61,63],{"class":43,"line":62},4,[41,64,65],{},"  total DECIMAL(10,2)\n",[41,67,69],{"class":43,"line":68},5,[41,70,71],{},");\n",[11,73,75],{"id":74},"when-youll-hear-this","When You'll Hear This",[16,77,78],{},"\"Always include a primary key on every table.\" \u002F \"The id column is the primary key.\"",[80,81,82],"style",{},"html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"title":36,"searchDepth":50,"depth":50,"links":84},[85,86,87,88],{"id":13,"depth":50,"text":14},{"id":21,"depth":50,"text":22},{"id":28,"depth":50,"text":29},{"id":74,"depth":50,"text":75},"database","A primary key is the unique ID that every row in a table must have. Like a social security number for your data — no two rows can have the same one.","beginner","md",{},true,"\u002Fterms\u002Fp\u002Fprimary-key",[97,98,99,100,101],"Foreign Key","UUID","Auto Increment","Table","Index",{"title":5,"description":90},{"changefreq":104,"priority":105},"weekly",0.7,"terms\u002Fp\u002Fprimary-key","noySNayyLwByO3Wsk4PrzrhJlvKKQJ7OD7cAbKzO__k",[109,112,115,119,122],{"title":99,"path":110,"acronym":6,"category":89,"difficulty":91,"description":111},"\u002Fterms\u002Fa\u002Fauto-increment","Auto increment means the database assigns the next ID number automatically every time you insert a row.",{"title":97,"path":113,"acronym":6,"category":89,"difficulty":91,"description":114},"\u002Fterms\u002Ff\u002Fforeign-key","A foreign key is how you link two tables together. If an 'orders' table has a 'user_id' column pointing to the 'users' table, that is a foreign key.",{"title":101,"path":116,"acronym":6,"category":89,"difficulty":117,"description":118},"\u002Fterms\u002Fi","intermediate","A database index is like the index in the back of a book. Without it, the database reads every single row to find what you want.",{"title":100,"path":120,"acronym":6,"category":89,"difficulty":91,"description":121},"\u002Fterms\u002Ft\u002Ftable","A database table is exactly like a spreadsheet tab. It has columns across the top (name, email, age) and rows going down (one per person).",{"title":98,"path":123,"acronym":124,"category":89,"difficulty":117,"description":125},"\u002Fterms\u002Fu\u002Fuuid","Universally Unique Identifier","A UUID is a randomly generated ID that looks like 'a3b4c5d6-...' and is practically guaranteed to be unique across the entire universe.",1776518303163]