how can u select the Distinct values in the table, table
having 20 columns , i want all columns
Answers were Sorted based on User's Feedback
Answer / uma
The SELECT DISTINCT Statement
The DISTINCT keyword is used to return only distinct
(different) values.
The SELECT statement returns information from table columns.
But what if we only want to select distinct elements?
With SQL, all we need to do is to add a DISTINCT keyword to
the SELECT statement:
Syntax
SELECT DISTINCT column_name(s)
FROM table_name
Using the DISTINCT keyword To select ALL values from the
column named "Company" we use a SELECT statement like this:
SELECT Company FROM Orders
"Orders" table
Company OrderNumber
Sega 3412
W3Schools 2312
Trio 4678
W3Schools 6798
Result
Company
Sega
W3Schools
Trio
W3Schools
Note that "W3Schools" is listed twice in the result-set.
To select only DIFFERENT values from the column named
"Company" we use a SELECT DISTINCT statement like this:
SELECT DISTINCT Company FROM Orders
Result:
Company
Sega
W3Schools
Trio
Now "W3Schools" is listed only once in the result-set.
Is This Answer Correct ? | 6 Yes | 3 No |
In which year relase the 7.0& 2000 & 2005?
What is buffer cash and log cache in sql server?
How to make remote connection in database?
Do you know what are different types of replication in sql server?
What are the steps to insert a table?
i want only duplicates rows from coloumn ex. emp_id(colomn name)1,1,2,3,3,4,5,5. so i want only duplicates no.
What is the correct order of the logical query processing phases?
How many levels of sp nesting is possible?
What is a system database and what is a user database?
How to Generate a Series of Random Integers With T-SQL?
How is sql used in sql server?
What is a data source file?