关闭

简单MySQL 语句

60人阅读 评论(0) 收藏 举报
USE spring;

/*
	drop table if exists Employee;
*/

CREATE TABLE Employee (
	id INT  PRIMARY KEY AUTO_INCREMENT,
	email VARCHAR(200),
	dept_id INT
);


SHOW TABLES FROM spring;

SELECT * FROM Employee;

ALTER TABLE Employee ADD NAME VARCHAR(36) AFTER id;


INSERT INTO employee(email,dept_id) VALUE("lucy@gmail.com",2);


UPDATE Employee SET NAME  = "ly" WHERE id = 2;
/*
 *更新多个字段
 */
UPDATE Employee SET NAME="Mary",email="mary@hotmail.com" WHERE id = 3;


UPDATE Employee SET NAME  = "lucy" WHERE email="lucy@gmail.com";

UPDATE Employee SET email = "test@qq.com" WHERE id = 1;


DELETE FROM Employee WHERE id  = 16;


DELETE FROM Employee WHERE id > 4 AND id < 15;


DELETE FROM Employee WHERE NAME = "CC";

0
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:29085次
    • 积分:1355
    • 等级:
    • 排名:千里之外
    • 原创:104篇
    • 转载:43篇
    • 译文:0篇
    • 评论:6条
    文章分类
    最新评论