Learn SQL — it’s every job post — part 2 create read update delete CRUD with SQL
We write beginner friendly articles like this, follow us for more. Today we will visit how to do four important tasks in SQL CREATE, READ, UPDATE, DELETE, known as CRUD.
Table of contents: part 1 — intro to SQL , part 2 create read update delete with SQL (this article).
SQL is the query language for tabular data (data that fits nicely in excel like tables) ; it is the query language for relational databases.
Relational database makes use of primary key (PK) and foreign key (FK). Each row in a table has an unique primary key. it is like each person has an unique ID number. Relational databases have entity tables such as products and customers for example, and also have association tables assoc
tables that connect the two such as orders table where each customer can buy one or more products at a time. The ID used to record the customer in the association table is known as the foreign key because it is not the primary key — order ID, it refers to unique IDs in another table.
CREATE READ UPDATE and DELETE (CRUD)
CRUD is an important concept in programming, not just in SQL database queries. It is a way to organizing code, writing code according to protocol and building an API. How SQL keywords SELECT, INSERT INTO, UPDATE and DELETE maps to CRUD:
SELECT → READ
INSERT INTO → CREATE
UPDATE → UPDATE
DELETE → DELETE