1.ipconfig :查看本机ip地址
2.ping ip地址:检查网络是否连通
insert into student (id,name,age,sex) values (1,'张三',18,'男');
insert into student values (2,'柳岩',20,'2000-01-09','女','安徽');
insert into student (id,name,age,birthday,sex,address) values (3,'戚薇',20,'2000-01-09','女','安徽');
insert into student values (4,'赵丽颖',20,'1990-01-09','女','安徽'),(5,'李佳琦',20,'1990-01-09','男','安徽');
insert into student (id,name,age,birthday,sex,address) values (6,'历史',12,'2020-01-09','男',null);
update student set sex = '男';
update student set sex = '女' where id =2;
select * from student st where st.id = 4;
update student set address = '北京' , birthday = '2001-09-01' where id =1;
delete from student where id = 1;
delete from student st where id in (5,6);
select distinct age from student;
select * from student where age <> 20;
select * from student where age !=20;
update student stu set age = 19 ;
select * from student where id in (1,2,3);
select * from student where id not in (1,2,3);
select * from student where math between 70 and 90;
select * from student where name like '赵__';
select * from student order by age desc;
select * from student order by age desc ,math desc ;
select sum(math)+sum(english) from student;
select sum(math+english) from student;
create table car(
id int,
color char(2),
price float
);
select color, sum(price) from car group by color;
select color ,sum(price) from car group by color having sum(price)>30;
select color ,sum(price) from car where price >15 group by color having sum(price) > 30;
select * from car limit 0,2;
```java
public class JDBCTest01 {
public static void main(String[] args) throws ClassNotFoundException, SQLException {
// Class.forName("com.mysql.jdbc.Driver");
String url = "jdbc:mysql://localhost:3306/test2?useUnicode=true&characterEncoding=utf8";
String user = "root";
String password = "123456";
Connection connection = DriverManager.getConnection(url, user, password);
String sql = "select * from userinfo";
Statement statement = connection.createStatement();
ResultSet resultSet = statement.executeQuery(sql);
while (resultSet.next()){
int id = resultSet.getInt("id");
String name = resultSet.getString("name");
int age = resultSet.getInt("age");
int sex = resultSet.getInt("sex");
System.out.println("id:"+id+" name:"+name+" age:"+age+" sex:"+sex);
}
resultSet.close();
statement.close();
connection.close();
}
}
select sum(ifnull(math,0)+ifnull(english,0)) as score from student