Text Article
[ Ссылка ]
Healthy diet is very important both for the body and mind. If you like Aarvi Kitchen recipes, please support by sharing, subscribing and liking our YouTube channel. Hope you can help.
[ Ссылка ]
Slides
[ Ссылка ]
SQL Server Interview Questions and Answers text articles & slides
[ Ссылка ]
SQL Server Interview Questions and Answers playlist
[ Ссылка ]
All Dot Net and SQL Server Tutorials in English
[ Ссылка ]
All Dot Net and SQL Server Tutorials in Arabic
[ Ссылка ]
In this video we will discuss writing a SQL query to retrieve all student names that start with letter 'M' without using the LIKE operator.
If the interviewer has not mentioned not to use LIKE operator, we would have written the query using the LIKE operator as shown below.
SELECT * FROM Students WHERE Name LIKE 'M%'
We can use any one of the following 3 SQL Server functions, to achieve exactly the same thing.
CHARINDEX
LEFT
SUBSTRING
The following 3 queries retrieve all student rows whose Name starts with letter 'M'. Notice none of the queries are using the LIKE operator.
SELECT * FROM Students WHERE CHARINDEX('M',Name) = 1
SELECT * FROM Students WHERE LEFT(Name, 1) = 'M'
SELECT * FROM Students WHERE SUBSTRING(Name, 1, 1) = 'M'
Ещё видео!