distinct?distinction
老铁们,大家好,相信还有很多朋友对于distinct和distinction的相关问题不太懂,没关系,今天就由我来为大家分享分享distinct以及distinction的问题,文章篇幅可能偏长,希望可以帮助到大家,下面一起来看看吧!
SQL中distinct的用法是什么
在表中,可能会包含重复值。这并不成问题,不过,有时您也许希望仅仅列出不同(distinct)的值。关键词 distinct用于返回唯一不同的值。
表A:
表B:
1.作用于单列
select distinct name from A
执行后结果如下:
2.作用于多列
示例2.1
select distinct name, id from A
执行后结果如下:
实际上是根据name和id两个字段来去重的,这种方式Access和SQL Server同时支持。
示例2.2
select distinct xing, ming from B
返回如下结果:
返回的结果为两行,这说明distinct并非是对xing和ming两列“字符串拼接”后再去重的,而是分别作用于了xing和ming列。
3.COUNT统计
select count(distinct name) from A;--表中name去重后的数目, SQL Server支持,而Access不支持
count是不能统计多个字段的,下面的SQL在SQL Server和Access中都无法运行。
select count(distinct name, id) from A;
若想使用,请使用嵌套查询,如下:
select count(*) from(select distinct xing, name from B) AS M;
4.distinct必须放在开头
select id, distinct name from A;--会提示错误,因为distinct必须放在开头
5.其他
distinct语句中select显示的字段只能是distinct指定的字段,其他字段是不可能出现的。例如,假如表A有“备注”列,如果想获取distinc name,以及对应的“备注”字段,想直接通过distinct是不可能实现的。但可以通过其他方法实现关于SQL Server将一列的多行内容拼接成一行的问题讨论
distinct什么意思
distinct的意思是明显的;独特的。
读音:英[dɪˈstɪŋkt],美[dɪˈstɪŋkt]。
释义:adj.明显的;独特的;清楚的;有区别的
例句:After that quarrel, there's a distinct change in her attitude towards me.
那次争吵后,他对我的态度有了明显的变化。
变形:比较级more distinct,最高级most distinct,副词distinctly,名词distinctness。
短语:
distinct from种类不同
distinct a不同的
distinct landforms显地形
distinct tastes不同的口味
词义辨析
distinct,distinctive这是两个形近单词。
distinct意思是“分明的”、“明了的”、“清楚的”(well-marked,clearly defined or easily discernible)。distinct还可用以表示“不同的”、“有区别的”意味。
distinctive意思是“表示差别的”、“有特色的”、“特殊的”(marking or showing a difference)。
词汇精选:distinct的用法和辨析
一、详细释义:
adj.
清晰的;清楚的;明白的;明显的
例句:
Incorporation establishes the business as a distinct financial entity.
有限责任公司财务账目清晰。
例句:
There is a distinct smell of oranges in this room!
这个房间里有明显的桔子味!
截然不同的;有区别的;不同种类的
例句:
The twins had distinct tastes.
这两个双胞胎嗜好不同。
例句:
Household electric appliances imported with original packing are really distinct from others.
原装进口的家用电器的确与众不同。
确定无疑的;确实的;确切的
例句:
The distinct evidence prove thief is guilty.
确切的证据证明小偷是有罪的。
例句:
The truth that Diaoyu Island is the part of China is distinct.
钓鱼岛是中国的一部分的事实是确定无疑的。
二、词义辨析:
apparent,obvious,evident,clear,plain,distinct,definite,manifest
这些形容词均含“清楚的,明白的,明显的”之意。
apparent强调显而易见或一想便知。这个词从动词appear派生而来,故有时含有表面如此而事实上未必的意味。
obvious语气较强,指极为明显,有目共睹,无需说明和论证。
evident指根据事实成为显然的。
clear普通用词,侧重清楚明白。
plain普通用词,含义与clear很接近,可通用,但plain着重简单明了,不复杂。
distinct较正式用词,指轮廓的清楚或定义、含义的明确,不会弄错。
definite语气肯定,着重明白无误,无可怀疑。
manifest语义较强,书面用词,强调一目了然,暗示不要任何推论就一清二楚。
三、参考例句:
Domicile is distinct from nationality.
住所与国籍不同。
The twins had distinct tastes.
这两个双胞胎嗜好不同。
Commutation is distinct from reprieve.
减刑不同于缓刑。
The distinct evidence prove thief is guilty.
确切的证据证明小偷是有罪的。
Here the two distinct theories converge.
在这一点上两种不同的理论不谋而合。
He has a distinct gift for drawing.
他有很明显的绘画天赋。
He has a distinct Scottish accent.
他有一口明显的苏格兰口音。
E-books are quite distinct from traditional books.
电子书和传统图书有很大的不同。
Those two ideas are quite distinct from each other.
这两种观点截然不同。
The lighthouse beam was quite distinct in the gathering dusk.
灯塔的光束在渐浓的暮色中清晰可见。
END,本文到此结束,如果可以帮助到大家,还望关注本站哦!