MySQL表的增删改查(基础)
增加(Create):
CREATE TABLE `user` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(255) DEFAULT NULL,
`email` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
插入(Insert):
INSERT INTO `user` (`name`, `email`) VALUES ('张三', 'zhangsan@example.com');
查询(Retrieve):
SELECT * FROM `user`;
更新(Update):
UPDATE `user` SET `name` = '李四' WHERE `id` = 1;
删除(Delete):
DELETE FROM `user` WHERE `id` = 1;
这些是MySQL表的基础增删改查操作,在实际开发中会根据业务需求进行复杂操作。
评论已关闭