一、表中数据操作
1.向表中插入数据
单行数据+全列插入:
insert into 表名 values(...);
多行数据+指定列插入:
insert into 表名(指定列...) values (...), (...);
2.查询表中数据
全列查询:
select * from exam_result;
通常情况下不推荐使用 * 进行全列查询,因为查询的列越多,意味着需要传输的数据量越大,可能会影响到索引的使用。
指定列查询:
select id, nam, english from exam_result;
查询字段为表达式:
select id, name, english+10 from exam_result;
别名:
select id, name, chinese + math + english as 总分 from exam_result;
去重:
select distinct math from exam_result;
排序