CRUD Operations: Writing Basic SQL
CRUD stands for Create, Read, Update, and Delete. These basic commands are used to insert records, query data, and manipulate existing table information.
1 Basic SQL Queries
SQL — CRUD Syntax
# 1. CREATE (Insert)
INSERT INTO users (username, email, age)
VALUES ('balaji', 'balaji@test.com', 25);
# 2. READ (Select)
SELECT username, email FROM users;
# 3. UPDATE
UPDATE users
SET age = 26
WHERE username = 'balaji';
# 4. DELETE
DELETE FROM users
WHERE id = 1;
2 Code Challenge
Challenge: Write an SQL statement inserting three products into your products table, query all records priced below $50, and update a product stock quantity to zero.