Skip to content
Related Articles

Related Articles

SQL query to find unique column values from table
  • Last Updated : 13 Aug, 2020

We take a sample table named Geeks and return unique column values by applying various SQL queries on it.


Table – Geeks
G_IDFIRSTNAMELASTNAMEJOININGDATEDEPARTMENT
1MohanArora7-08-2019DBA
2NishaVerma25-03-2017Admin
3VishalGupta9-01-2020DBA
4AmitaSingh5-12-2017Writer
5VishalBharti3-05-2018Admin
6VinodDiwan19-04-2018Review
7SheetalKumar5-01-2017Review
8GeetaChauan5-02-2019Admin
9MonaMishra15-01-2018Writer



SQL query to find unique values of column department from Geeks table.

Select distinct DEPARTMENT 
from Geeks;

Output –



DEPARTMENT
Admin
DBA
Review
Writer



SQL query to find details of column department where name as “DBA”.

Select * 
from Geeks 
where DEPARTMENT like 'DBA%';

Output –

G_IDFIRSTNAMELASTNAMEJOININGDATEDEPARTMENT
1MohanArora7-08-2019DBA
3VishalGupta9-01-2020DBA



SQL query to find the count of rows in the department ‘Admin’.

SELECT COUNT(*) 
FROM Geeks 
WHERE DEPARTMENT = 'Admin';

Output –

(No column name)
3

My Personal Notes arrow_drop_up
Recommended Articles
Page :