SQL SELECT DISTINCT Statement

The SQL SELECT DISTINCT syntax

The general syntax is:

  1. SELECT DISTINCT columnname
  2. FROM tablename

Can be used with COUNT and other aggregates

  1. SELECT COUNT (DISTINCT columnname)
  2. FROM tablename

 


 

SQL SELECT Examples

Problem: List all supplier countries in alphabetical order.

  1. SELECT DISTINCT Country
  2. FROM Supplier
  3. ORDER BY COUNTRY

Results: 16 rows

Country
Australia
Brazil
Canada
Denmark

 


Problem: List the number of supplier countries

  1. SELECT COUNT (DISTINCT Country)
  2. FROM Supplier

Results:

Count
16

Comments (52)

  1. Pingback: mơ thấy đi chợ

  2. Pingback: mơ thấy đá bóng đánh con gì

  3. Pingback: mơ thấy giày dép đánh con gì

  4. Pingback: mơ thấy chìa khóa

  5. Pingback: nằm mơ thấy cháy rừng

  6. Pingback: mơ thấy chim bồ câu đánh con gì

  7. Pingback: 토토사이트

  8. Pingback: dog food

  9. Pingback: mơ thấy cãi nhau đánh con gì

  10. Pingback: mơ thấy đỉa bám đầy người

  11. Pingback: mơ bắt cá trê

  12. Pingback: mơ thấy con ngựa

  13. Pingback: Look At This

  14. Pingback: bí kíp giữ chồng

  15. Pingback: mơ bắt được ếch đánh con gì

  16. Pingback: mơ thấy gái đánh con gì

  17. Pingback: Where Can I Buy Oxycontin

  18. Pingback: sahabatqq daftar

  19. Pingback: paito warna

  20. Pingback: https://www.paintingandplowing.com

  21. Pingback: porn

  22. Pingback: USA online gun broker

  23. Pingback: 메이저놀이터

  24. Pingback: modern office ideas

  25. Pingback: how to spot a fake rolex daytona

  26. Pingback: 메이저놀이터

  27. Pingback: ดูบอล

  28. Pingback: world market darknet

  29. Pingback: social activities for kids with autism

  30. Pingback: ilk üyelik bonusu veren bahis siteleri

  31. Pingback: W88

  32. Pingback: learning activities for host kids

  33. Pingback: dich vu seo

  34. Pingback: gửi hàng đi mỹ

  35. Pingback: 3d printer

  36. Pingback: arvest central mortgage co

  37. Pingback: bulut depolama,bulut,yedekleme,ücretsiz bulut hizmeti,en iyi bulut şirketi,en iyi bulut firması,bulut depolama fiyatı,en ucuz bulut depolama,en iyi bulut depolama hangisi,en iyi bulut depolama,bulut arşivleme sistemi,online yedekleme,bulut yedekleme

  38. Pingback: microsoft exchange mail

  39. Pingback: hp sunucu servis

  40. Pingback: bilişim danışmanlık hizmeti

  41. Pingback: Sunucu Teknik Destek

  42. Pingback: kurumsal sunucu servisi

  43. Pingback: bilişim danışmanlık sözleşmesi

Leave a comment

이메일 주소는 공개되지 않습니다.