SQL增删改
USE sqlxx CREATE TABLE ygb( sid INT, sname VARCHAR(20), sgender VARCHAR(2), sbirthday DATE, semail VARCHAR(10), sremark VARCHAR(50) ) DESC ygb; SELECT * FROM ygb; /*增加age列*/ ALTER TABLE ygb ADD COLUMN sage INT; /*改变age列的属性为int*/ ALTER TABLE ygb MODIFY COLUMN sage INT; /*将email的varchar改为50*/ ALTER TABLE ygb MODIFY COLUMN semail VARCHAR(50); /*删除remark列*/ ALTER TABLE ygb DROP COLUMN sremark; /*将name的名字改为username*/ ALTER TABLE ygb CHANGE COLUMN sname username VARCHAR(20) /*在列中添加数据,按顺序来*/ INSERT INTO ygb VALUES(123,'韩凯','男','2018-05-01','1051765559@qq.com',27) INSERT INTO ygb VALUES(213,'小韩','男','2018-01-01','1051765558@qq.com',24) INSERT INTO ygb VALUES(312,'小张','男','2018-03-17','1051765557@qq.com',25) /*删除id为213的那一行*/ DELETE FROM ygb WHERE sid=213; DELETE FROM ygb WHERE username='韩凯'; /*将id为312的行性别改为女、名字改为张乐*/ UPDATE ygb SET sgender='女',username='张乐' WHERE sid=312;