Answer the question
In order to leave comments, you need to log in
How to select elements in sql server that have 3 or more vowels?
Here is the task:
Add to the created table teachers whose last names contain 3 or
more vowels .
I need to somehow implement this through like , but I don’t know how to register it.
Answer the question
In order to leave comments, you need to log in
DECLARE @teachers TABLE ([LastName] NVARCHAR(255) NOT NULL);
INSERT INTO @teachers
VALUES
(N'Холстинин'),
(N'Пирожков'),
(N'Пугачева'),
(N'Цой');
DECLARE @vowels TABLE ([Letter] NCHAR(1) NOT NULL);
INSERT INTO @vowels VALUES
(N'а'),
(N'о'),
(N'и'),
(N'е'),
(N'ё'),
(N'э'),
(N'ы'),
(N'у'),
(N'ю'),
(N'я');
SELECT [t].[LastName]
FROM @teachers [t]
CROSS JOIN @vowels [v]
GROUP BY [t].[LastName]
HAVING SUM(LEN([t].[LastName]) - LEN(REPLACE([t].[LastName], [v].[Letter], ''))) > 3;
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question