+ 3

How to select unique value in a column

I have a set of value like 5,5,6,2,7,6,7 and I want to write a SQL query to select the unique number only .how can I do that ?

2nd Mar 2017, 7:48 AM
Luqmaan Mudasiru
Luqmaan Mudasiru - avatar
5 Réponses
+ 9
• you could set your coulmn as primary key so that values dont repeat • incase you want your repititve values you can use the syntax SELECT DISTINCT column_name FROM table
2nd Mar 2017, 7:56 AM
Akshata
Akshata - avatar
+ 1
select distinct column_name from table_name;
2nd Mar 2017, 7:53 AM
Aman Hanjra
Aman Hanjra - avatar
0
use distinct
2nd Mar 2017, 8:21 AM
Raj Kumar Chauhan
Raj Kumar Chauhan - avatar
0
TO SELECT Select Distinct(colname) from tablename; TO MAKE IT UNIQUE PERMANENTLY alter table tablename add unique key(colname);
2nd Mar 2017, 10:38 AM
Meharban Singh
Meharban Singh - avatar