获取数据库链接:
Class.forName(“com.mysql.jdbc.Driver”);
Connection connection=DriverManager.getConnection(“jdbc:mysql://localhost:3306/shuo(工程名)”, “root(账号)”, “123(密码)”);
删除:
delete from user(表名) where id=2(删除的条件);
添加:
insert into user(表名)(id, name, balance, type(添加那些数据)) VALUES (2,‘李四’,4000,1(添加的数据值));
查询所有:
select * from ueset (表名)
带条件查询:
select * from ueset表名 where id=2条件;
修改:
update ueset(表名)set name=‘赵丽颖’,password=‘zjy123’,type=‘男’(需要修改的数值) where id=2(需要修改的条件)