SQL With a Smile by Kellner Elaine
Author:Kellner, Elaine
Language: eng
Format: epub
Tags: SQL
Published: 2016-03-13T16:00:00+00:00
OrderDate
OrderID
DrinkID
2/5/2016
1
2
2/5/2016
1
5
2/5/2016
1
4
2/5/2016
1
3
2/5/2016
1
6
There’s a fix for that, though! If we want to see how many unique order IDs we have, we can use COUNT(DISTINCT) instead:
SELECT COUNT(DISTINCT OrderID) AS Order_Count
FROM DrinkOrders
Results:
Order_Count
1
There we go!
A word of caution - You can use COUNT(DISTINCT) even in those cases where you don’t have duplicate values. For example, using either COUNT(DrinkID) or COUNT(DISTINCT DrinkID) against our Menu table will both return the correct value of 5:
Download
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
Deep Learning with Python by François Chollet(15296)
The Mikado Method by Ola Ellnestam Daniel Brolund(12563)
Hello! Python by Anthony Briggs(12427)
OCA Java SE 8 Programmer I Certification Guide by Mala Gupta(11745)
Dependency Injection in .NET by Mark Seemann(11545)
A Developer's Guide to Building Resilient Cloud Applications with Azure by Hamida Rebai Trabelsi(10532)
Algorithms of the Intelligent Web by Haralambos Marmanis;Dmitry Babenko(10359)
The Well-Grounded Java Developer by Benjamin J. Evans Martijn Verburg(10048)
Grails in Action by Glen Smith Peter Ledbrook(9682)
Secrets of the JavaScript Ninja by John Resig Bear Bibeault(9320)
Sass and Compass in Action by Wynn Netherland Nathan Weizenbaum Chris Eppstein Brandon Mathis(9168)
Hit Refresh by Satya Nadella(9040)
Test-Driven iOS Development with Swift 4 by Dominik Hauser(8500)
The Kubernetes Operator Framework Book by Michael Dame(8479)
Exploring Deepfakes by Bryan Lyon and Matt Tora(8300)
Robo-Advisor with Python by Aki Ranin(8256)
Practical Computer Architecture with Python and ARM by Alan Clements(8228)
Implementing Enterprise Observability for Success by Manisha Agrawal and Karun Krishnannair(8198)
Building Low Latency Applications with C++ by Sourav Ghosh(8103)