数据库面试题(卷).doc

数据库笔试题(含参考答案) 现在有个表:A(id ,name,regdate) B(id,groupid) C(id,name2) 写出下面的SQL语句 1.统计A表中每个月注册用户数 2.统计A表中有姓名相同的用户数 3.如果表A中有姓名相同的用户,把相同的查出,写入表C中 4.A中ID有多个相同的数据,A中姓名相同的ID只保留注册时间最大的数据 大家帮帮忙,写一下吧 1 select count(*),to_char(regdate,yyyymm) from A group by to_char(regdate,yyyymm); 2 select count(*) from (select name from A group by name having count(*) 1); 3 insert into C(name2) select name from A group by name having count(*) 1; 4 delete from A E where e.regdate (select max(regdate) from a X where E.id = X.id); redate(格式为2007/02/12) 日期自己转化一下 SQL select to_date(2007/02/12,yyyy/mm/dd) fro

文档评论(0)

1亿VIP精品文档

相关文档