【MySQL】表的基本操作
创建表:
CREATE TABLE IF NOT EXISTS users (
id INT AUTO_INCREMENT PRIMARY KEY,
username VARCHAR(50) NOT NULL,
password VARCHAR(50) NOT NULL,
email VARCHAR(100)
);
插入数据:
INSERT INTO users (username, password, email) VALUES ('user1', 'pass1', 'user1@example.com');
查询数据:
SELECT * FROM users;
更新数据:
UPDATE users SET password = 'newpass' WHERE id = 1;
删除数据:
DELETE FROM users WHERE id = 1;
删除表:
DROP TABLE IF EXISTS users;
评论已关闭