表现重复:select * from tablename group by id having count(*)>1
不表现重复:select * from tablename group by id having count(*)=1
4、什么是数据库的映射
就是将数据库的表与字段对应到模子层类名与属性的过程.
5、写分页有哪些方法,你一样平常用什么方法?用SQL语句写一个分页?
怎样用存储过程写分页?
在SQLSERVER中利用TOP分页,在ORACLE中用ROWNUM,或分析函数ROW_NUMBER
利用TOP:
select top 20,n.* from tablename n minus select top 10,m.* from tablename m
利用分析函数:
select * from
(select n.*,row_number() over(order by columnname) num from tablename n)
where num>=10 and num <=20;
利用过程时,只要将分页的范围用两个参数就可以实现。在ORACLE中,要将过程封装在包里,还要用动态游标变量才能实现数据集的返回。
6、ORACLE中左连接与右连接
左连接:LEFT JOIN 右连接:RIGHT JOIN
select n.column,m.column from tablename1 n left join tablename2 m
on n.columnname=m.columnname
用WHERE实现:
select n.column,m.column from tablename1 n, tablename2 m
where n.columnname(+)=m.columnname 7、什么是反射、序列化、反序列化?事务有几种级别?