0

Hii guys, Here v can discuss about Problems in database design. If u know the answers , plese post ur answers here.
How do u get the distinct rows in a table/resultset?
How do u get the distinct rows without using the keyword DISTINCT?

6
Contributors
6
Replies
13
Views
9 Years
Discussion Span
Last Post by subnet0
0

By using the DISTINCT keyword,this can be achieved.The following example selects the distinct names from the employee table.
SELECT DISTINCT lname FROM employee.

By using the GROUP BY keyword,this can be achieved.The following example selects the distict names in the employee table,without using the DISTINCT keyword.
SELECT lname FROM employee GROUP BY lname.

0

Hey guys,
Me too have one doubt regarding database.

How can we insert a values in multiple rows using one insert statement ?
Please show one example.

0

Haii..
The answer is,
INSERT INTO table
select('value1','Cina')
UNION ALL
select('value2','Dina')
UNION ALL
select('value3','Tina')

Thank you..

0

Hieo frnds...
Please help me out for finding the answer for this problem.

How can we get the duplicate rows from the table listed below using a single query.??

field1 field2 field3

1 2 3
2 4 5
2 4 5
3 4 3
1 2 3

0

Hii frnds..
CREATE INDEX myIndex ON myTable(myColumn). What type of index will get created after executing the above statement? Why ?

and How can we swap values between two rows in a table using single sql statement?
show some examples also..

0

Hieo frnds...
Please help me out for finding the answer for this problem.

How can we get the duplicate rows from the table listed below using a single query.??

field1 field2 field3

1 2 3
2 4 5
2 4 5
3 4 3
1 2 3

1> select *,count(*) as instances from DUPS group by field1,field2,field3
2> go
field1 field2 field3 instances
----------- ----------- ----------- -----------
1 2 3 2
2 4 5 2
3 4 3 1

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.