--查询每名学生的学号、选修课程数目、总成绩、并将查询结果存放到生成的’学生选课统计表‘中use teachinggoif exists (select * from sys.objects where name='学生选课统计表')drop table 学生选课统计表select studentno,COUNT(*) as '选修课程数目',sum(final) as '总成绩' i
表的结构如下: create table mytable( id int not null, [name] varchar(10) null) 表的记录如下: --以下是正确的统计sql语句如下: select count(id) as 行数 from mytable --统计结果为2 --以下sql语句也可执行正确的统计结果,即使有些字段在表中没有.select coun