例如:
select sum(balance) as Sum-Of-Balance
from account
where branch-name = "Perryridge"
��在这里,我们需要强调的是SQL表达式中"*"的使用:
��⑴�一般来说,计算一个关系中元组的个数使用函数count(*),这时,绝对不能使用distinct选项;例如:
select count(*) from customer
select count(distinct customer-city) from customer
而select count(distinct *) from customer则是错误的语句。
��⑵�一般来说,表示关系中的所有属性使用符号"*",而为了找出一个关系中的不同元组则可以在"*"之前使用保留字distinct,例如:select
* from customerselect distinct * from customer
��
�� |
|