create table emp like student; 创建一个表emp,表结构复制student表
复制代码
update修改表数据
update emp set age=18 where id=1; 更新emp表id=1的age为18
update 数据库 set 修改内容 where 过滤条件
复制代码
delete删除表数据
delete from emp where name='xiaoming';删除表emp中name=‘xiaoming’的记录
复制代码
查询:分组 group by
select gender,avg(age) from students group by gender;
select 性别字段,平均(年龄)from 表名 group by 性别字段
按照性别分组,男女分别的平均年龄
⭐️分组之后再过滤不能用where 用having
复制代码
查询:分组后排序order by
select classid,gender,avg(age) from students group by classid,gender order by classid;<br>查询classid,gender,avg(age) 从students表 分组classid,gender 根据classid排序
<img alt="" ><img id="HelpImg"><img id="EmbedImg"><img id="ShareImg"> TRANSLATE with <img id="CollapsedLogoImg"> COPY THE URL BELOW <img id="EmailImg"> <img id="ShareHelpImg"> Back EMBED THE SNIPPET BELOW IN YOUR SITE <img id="EmbedHelpImg">Enable collaborative features and customize widget: Bing Webmaster PortalBack
免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!