每个国家住店总人数: T-SQL代码: select b.natioality,count(b.natioality) from CustomerInfo a left outer join NationalInfo b on a.nationalid=b.nationalid group by b.natioality
'新加坡'籍的可人都使用哪几种证件入住: T-SQL代码: select distinct a.certificate from CustomerInfo a left outer join NationalInfo b on a.nationalid=b.nationalid where b.nationality='新加坡'
’中国‘籍入店的男女人数: T-SQL代码: select count(sex), case sex when '1' then '男' else '女' end from CustomerInfo a left outer join NationalInfo b on a.nationalid=b.nationalid where b.nationality='中国' group by case sex when '1' then '男' else '女' end