1.添加数据使用关键字insert
mysql> insert into stu(id,name,gender,age)values(1,'张三','男',20);
mysql> insert into stu(name,gender,age)values('李四','女',23);
mysql> insert into stu values(3,'王五','女',19);
mysql> insert into stu(name,gender,age)values('张飞','男',28),('关羽','男',29),('刘备','男',30);
2.删除数据使用关键字delete
mysql> delete from stu where id=1;
mysql> delete from stu where id=1 and name='张飞';
3.修改数据使用关键字update
mysql> update stu set name='李四' where id=1;
mysql> update stu set name='张三', age=25 where id=1;
mysql> update stu set name="王五", gender="女" where id=2;
4.查询数据使用关键字select
mysql> select name, gender from stu;
mysql> select name, gender from stu where id = 5;
mysql> select * from stu where id>3;
网友评论