-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdistinct.html
More file actions
29 lines (24 loc) · 1.47 KB
/
distinct.html
File metadata and controls
29 lines (24 loc) · 1.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<!-- SECCIÓN DISTINCT -->
<div id="distinct-section">
<div id="adsense-container" style="width: 350px; position: absolute; left: 0px;"></div>
<div class="inner-modal">
<div class="inner" style="padding: 0px;">
<h1>SQL SELECT DISTINCT Statement</h1>
<p>The SELECT DISTINCT statement is used to return only distinct (different) values.</p>
<p>Inside a table, a column often contains many duplicate values; and sometimes you only want to list the
different (distinct) values.</p>
<h2>SELECT DISTINCT Syntax</h2>
<pre><code class="language-sql">SELECT DISTINCT column1, column2, ...
FROM table_name;</code></pre>
<h2>SELECT Example Without DISTINCT</h2>
<p>The following SQL statement selects all (including duplicates) values from the first_name column in the
patients table:</p>
<pre><code class="language-sql">SELECT first_name FROM patients;</code></pre>
<h2>SELECT DISTINCT Examples</h2>
<p>Now, let us use the SELECT DISTINCT statement and see the result:</p>
<pre><code class="language-sql">SELECT DISTINCT first_name FROM patients;</code></pre>
<p>The following SQL statement lists the number of different (distinct) first_name values:</p>
<pre><code class="language-sql">SELECT COUNT(DISTINCT first_name) FROM patients;</code></pre>
</div>
</div>
</div>