mysql常用sql语句

查询:

SELECT * FROM `person`

SELECT * FROM `person` WHERE `id` = 1

SELECT name,age FROM `person` WHERE number = 666333

插入:

INSERT INTO `person` (`id`, `name`, `sex`, `age`, `number`) VALUES (‘1’, ‘小红’, ‘女’, ’18’, ‘333666’), (‘2’, ‘李明’, ‘男’, ’24’, ‘666333’);
INSERT INTO `article` (`id`, `article_id`, `titile`, `content`, `articleLink`, `crawlSign`, `publishSign`) VALUES (NULL, ‘1’, ‘1’, ‘1’, ‘1’, ‘1’, ‘1’), (NULL, ‘1’, ‘1’, ‘1’, ‘1’, ‘1’, ‘1’);
更新:

UPDATE `person` SET `age` = ’33’ WHERE `person`.`id` = 3;

UPDATE `person` SET `name` = ‘李爱华’ WHERE `person`.`number` = 333666

UPDATE `articles` SET `title_en` = ‘1’`content_en` = ‘1’ WHERE `articles`.`id` = 3998;

删除:

DELETE FROM `person` WHERE `person`.`id` = 4

删除表:

DROP TABLE `test`.`person`

清空表:
TRUNCATE `test`.`person`

建表:

CREATE TABLE `test`.`student` ( `id` INT NOT NULL AUTO_INCREMENT , `name` VARCHAR(6) NOT NULL , `sex` VARCHAR(2) NOT NULL , `age` INT(3) NOT NULL , `number` INT(6) NOT NULL , PRIMARY KEY (`id`)) ENGINE = MyISAM;