两个简单问题,请教!!!

1\
a表里3条数据,b表里4条,使用下面的查询语句,结果返回 12条语句,我试出来了,可是为什么?
Select a.*,b.* from a,b;

2\
select a_name,count(*)”number of employees”
from a,b
where ano = a_no
and count (*) > 5
group by a_name
order by 2 desc;

and count (*) > 5 会引发例外,为什么?

请解释详细点,thanks!
[336 byte] By [happyying-小莹] at [2007-12-16]
# 1
1.对的,笛卡儿积
2.语法错,
select a_name,count(*) ”number of employees”
from a,b where ano = a_no
group by a_name
having count (*) > 5
order by 2 desc;
jlandzpa-jlandzpa at 2007-10-23 > top of Msdn China Tech,Oracle,基础和管理...
# 2
学习一下sql基本知识就明白为何1出现12条数据
像sum,count,avg等函数时不能出现在where语句里
他们做条件时候用在having里
sgq_hit-老槐树 at 2007-10-23 > top of Msdn China Tech,Oracle,基础和管理...
# 3
1.笛卡儿积
2.group by 时,count()要放在having 里.应改成:

select a_name,count(*) ”number of employees”
from a,b where ano = a_no
group by a_name
having count (*) > 5
order by 2 desc;

mashansj-风影 at 2007-10-23 > top of Msdn China Tech,Oracle,基础和管理...
# 4
1、数据库的结果集使用笛卡尔乘积运算
2、不能把count(*)放在where 后边做为限制条件,因为count(*)不是表a,b中的一个列
glmcglmc-joe at 2007-10-23 > top of Msdn China Tech,Oracle,基础和管理...
# 5
介绍你个网站
http://www.oradb.net
mashansj-风影 at 2007-10-23 > top of Msdn China Tech,Oracle,基础和管理...
# 6
www.dbforums.net
# 7
1、如果没有WHERE条件约束,则结果肯定是12条,笛卡尔乘积运算的结果,既A表的每一条记录对应B表中所有的记录,结果等于记录的乘积。
2、语法错误
select a_name,count(*) ”number of employees”
from a,b where ano = a_no
group by a_name
having count (*) > 5
order by 2 desc;
having必须配合group by 使用,看看关于pl/sql方面的书。
qiuyang_wang-小数点 at 2007-10-23 > top of Msdn China Tech,Oracle,基础和管理...
# 8
thanks
happyying-小莹 at 2007-10-23 > top of Msdn China Tech,Oracle,基础和管理...