Wednesday, November 23, 2011

MS SQL SERVER Stuff

TBL_Demo1

id  name       salary
1   Avik       23000
2   jitesh     32000
3   Neeru      25000
4   anurag     50000
5   paras      21010
6   avik       23000
7   Neeru      25000



Q.1 write a query for following output

id  name       repetedno
1   Avik       2
4   anurag     1
2   jitesh     1
3   Neeru      2
5   paras      1


Query :
SELECT id,name,count(name) as repetedno from TBL_Demo1 group by name

2.


Geography
region_name store_name
East Boston
East New York
West Los Angeles
West San Diego


SELECT CONCAT(region_name,store_name) FROM Geography
WHERE store_name = 'Boston';

Result:
'EastBoston'.



No comments:

Post a Comment