以下是一些用于执行 CRUD 操作(创建、读取、更新、删除)的基本 MySQL 语句:
1.Create (Insert):
INSERT INTO table_name (column1, column2, ...)
VALUES (value1, value2, ...);
Example:
INSERT INTO users (username, email)
VALUES ('john_doe', 'john@example.com');
2.Read (Select):
SELECT column1, column2, ...
FROM table_name
WHERE condition;
Example:
SELECT * FROM users WHERE id = 1;
3.Update:
UPDATE table_name
SET column1 = value1, column2 = value2, ...
WHERE condition;
Example:
UPDATE users SET email = 'newemail@example.com' WHERE id = 1;
4.Delete:
DELETE FROM table_name
WHERE condition;
Example:
DELETE FROM users WHERE id = 1;