write a query for list of owner who are having multiple
bikes in below table
1 shanker pulsar
2 shanker Honda
3 shanker car
4 Balu pulsar
5 Balu Honda
6 Balu car
7 Shyam pulsar
8 Jaya Honda
9 Deepa car
10 vasu car
Answer Posted / lakshmi narayanan r
CREATE TABLE bikes (bikeID INT, CName VARCHAR(50), BNAME
VARCHAR(50))
INSERT INTO bikes(CName, BNAME) VALUES ('shanker', 'pulsar')
INSERT INTO bikes(CName, BNAME) VALUES ('shanker', 'Honda')
INSERT INTO bikes(CName, BNAME) VALUES ('shanker', 'car')
INSERT INTO bikes(CName, BNAME) VALUES ('Balu', 'pulsar')
INSERT INTO bikes(CName, BNAME) VALUES ('Balu', 'Honda')
INSERT INTO bikes(CName, BNAME) VALUES ('Balu', 'car')
INSERT INTO bikes(CName, BNAME) VALUES ('Shyam', 'pulsar')
INSERT INTO bikes(CName, BNAME) VALUES ('Jaya', 'Honda')
INSERT INTO bikes(CName, BNAME) VALUES ('Deepa', 'car')
INSERT INTO bikes(CName, BNAME) VALUES ('vasu', 'car')
;WITH tmp (RowId, CName) AS (SELECT ROW_NUMBER() OVER
(PARTITION BY CName ORDER BY BikeID ASC) AS RowId, CName
FROM Bikes)
SELECT DISTINCT CName FROM tmp WHERE RowId > 1
| Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
What new changes are being made in SQL Server?
Find first and last day of current month in sql server
You want to be sure that queries in a database always execute at the maximum possible speed. To achieve this goal you have created various indexes on tables which other statement will keep the database in good condition?
As per your opinion what are the five top responsibilities of a dba? : sql server database administration
What are user-defined functions (udfs) in sql server?
How to provide login information for a new odbc dsn?
Tell me about normalization in DBMS.
What is key set driven?
how to create “alternate row colour”?
What languages bi uses to achieve the goal?
Can coalesce return null?
What is join and name different type of joins?
How many replicas are maintained for each sql azure db?
How can you manage sql azure security?
What is a user-defined function in the sql server and what is its advantage?