Select is used to display all columns from a table. This includes records with redundancies. So if you want to display records without redundancies, in short without duplicates, you use the keyword
DISTINCT or
GROUP BY.
Syntaxselect DISTINCT column_name from table_name
select * from table_name GROUP BY column_name
Table |
CUSTOMER |
SQL Codeselect DISTINCT customer_name,customer_address from customer
select customer_name,customer_address from customer GROUP BY customer_name
Output
SQL SELECT DISTINCT AND GROUP BY: Select Distinct Values in SQL and Group By
No comments:
Post a Comment