What is SQL Distinct ?
Hi,
The Distinct is used in SQL if you want to remove duplicates in any of your tables.
Say in a table named 'tab' there are two rows with the same entry.
Say 'Andy' and again 'Andy'. In this case you will use distinct to remove one of these.
The syntax is like:
- Select Distinct columns.
- From tables.
- Where predicates.
Thanks.
What is SQL Distinct ?
Hello Aksha,
1. SQL is Structure Query Language. SQL is a language that manipulate the database.
2. In SQL there are some types of commands like DDL commands, DML command, DTL commands etc.
3. In DDL commands means Data definition Language we can Create Table, Delete Table.
4. In DML commands means Data Manipulate Language. Using DML commands we can insert data into table, delete entry, update etc.
5. DCL Commands means Data Control language. Using these Commands we control the database.
Thanks, Regards,
Zafar Ali
What is SQL Distinct ?
Hi Aksha Dave,Â
First, let me introduce to you what SQL Distinct is all about. SQL is an acronym for Structured Query Language in which it is a standard relational query language used for interaction with databases. SQL defines many keywords in which it is divided into different categories.
SQL Distinct is a command used along with the SELECT keyword which retrieves only unique data entries depending on the column list that you have specified after it. The DISTINCT keyword is a command which removes the duplicates from the result set returned by your SELECT SQL statement.
What is SQL Distinct ?
Hello Aksha,
What is SQL Distinct ?
A table may contain a lot of data in it; some columns will contain duplicate values.
The DISTINCT keyword can be used to return only unique values.
Look at Table Contact:
Individual Id |
First Name |
Last Name |
1 |
Xavier |
Smith |
2 |
Jacobs |
Simmons |
3 |
O’Brain |
Pattison |
4 |
Jacobs |
Smith |
5 |
Xavier |
Drew |
SQL statement
SELECT DISTINCT(First Name) FROM Contact.
OUTPUT
First Name
Xavier
O’Brain
Jacobs
Thank You.
What is SQL Distinct ?
What is SQL Distinct ?
The SELECT keyword allows us to grab all information from a column (or columns) on a table. This, of course, necessarily mean that there will be redundancies. What if we only want to select each DISTINCT element? This is easy to accomplish in SQL. All we need to do is to add DISTINCT after SELECT. The syntax is as follows:
What is SQL Distinct ?
Hi Mr. Dave,
SQL Distinct it is a command where you specify what column or list you choose.
It illustrates to use the word DISTINCT to make it work. Example:
SELECT DISTINCT CITY
FROM User.
TABLE User.
NAMES | CITY |
JOHN | cebu |
Emily | leyte |
After executing distinct.
CITY |
cebu |
leyte |
And to follow you may go to this website so you can understand it more.