We take a sample table named Geeks and return unique column values by applying various SQL queries on it.
Table – Geeks
SQL query to find unique values of column department from Geeks table.
Select distinct DEPARTMENT from Geeks;
SQL query to find details of column department where name as “DBA”.
Select * from Geeks where DEPARTMENT like 'DBA%';
SQL query to find the count of rows in the department ‘Admin’.
SELECT COUNT(*) FROM Geeks WHERE DEPARTMENT = 'Admin';
|(No column name)|
Attention reader! Don’t stop learning now. Get hold of all the important CS Theory concepts for SDE interviews with the CS Theory Course at a student-friendly price and become industry ready.
- Difference between Structured Query Language (SQL) and Transact-SQL (T-SQL)
- Query to find 2nd largest value in a column in Table
- SQL | Query to select NAME from table using different options
- SQL query to find second highest salary?
- SQL | SELECT Query
- Structured Query Language (SQL)
- SQL | Query Processing
- What are the Best Ways to Write a SQL Query?
- Features of Structured Query Language (SQL)
- SQL query using COUNT and HAVING clause
- SQL Query Complexity
- SQL | UNIQUE Constraint
- Unique Constraint in MS SQL Server
- SQL | Create Table Extension
- How to Get the names of the table in SQL
- SQL | Checking Existing Constraints on a Table using Data Dictionaries
- What is Temporary Table in SQL?
- SQL | Declare Local Temporary Table
- DUAL table in SQL
- Table operations in MS SQL Server
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.