+ 2

How to extract records of "PlayerName" who have "David" in his name at any position from the "tournament" table In MS SQL Server

Suppose that there are following records in "PlayerName" :- 1. David 2. David Bekham 3. Davidson 4. Bred david 5. Harleydavidson 6. David Rooney 7. Don David Bradman Note :- I don't want that my result show "Harleydavidson" and "Davidson" type of name... I want those player who have only "David" name or with surname.

17th Jul 2022, 8:22 PM
Dumb Coder đŸ€Ą
Dumb Coder đŸ€Ą - avatar
6 Answers
+ 3
If you were to have columns in PlayerName called FirstName & LastName, then you could do the following SELECT * from PlayerName WHERE FirstName = 'David' OR LastName = 'David';
17th Jul 2022, 8:45 PM
Rik Wittkopp
Rik Wittkopp - avatar
+ 3
Or you could try this SELECT * from PlayerName WHERE Name LIKE 'David'; This assumes your column containing these names is called Name. It should return any row which has David as a stand-alone string
17th Jul 2022, 8:54 PM
Rik Wittkopp
Rik Wittkopp - avatar
+ 3
SELECT * from Tournament where PlayerName LIKE 'David%';
18th Jul 2022, 1:24 AM
De Vil
De Vil - avatar
+ 1
Rik Wittkopp if I applied ur statement then it's also shows the name "Davidson"... But I only want those player name whose name is "David".. It can be first name, last name, or middle name.
18th Jul 2022, 7:02 AM
Dumb Coder đŸ€Ą
Dumb Coder đŸ€Ą - avatar
0
I'm not sure but you can try Select * from Tournament where PlayerName LIKE '_David_';
18th Jul 2022, 11:40 PM
Aremu David
Aremu David - avatar
- 1
MUSAB lives gsfbs
19th Jul 2022, 6:52 AM
Ù…Ű­Ù…ŰŻ Ù…Ű­Ù…ŰŻ
Ù…Ű­Ù…ŰŻ Ù…Ű­Ù…ŰŻ - avatar