先创建一个数据库表
create table stu(
id int primary key auto_increment,
name varchar(10) not null,
age int not null
);
之后就可以进行添加,删除,更新数据的操作了
添加数据有3种方式
insert into stu (id,name,age) values(1,'张三',21);/*第一种*/
insert into stu values(2,'李四',22);/*第二种*/
insert into stu values(3,'李五',23),(4,'王五',24);
select *from stu;
查询结果
修改表数据
执行语句
update stu set name ='赵六' where id=1;
删除表数据
delete from stu where name='李四';
运行结果