LINQ Equivalent to SQL Betwein

Is LINQ To SQL equivalent to the SQL keyword between?

Do I just need to Andcompare both?

SELECT first_name, last_name
  FROM people
 WHERE last_name between 'Smith' and 'Thompson'
+3
source share
2 answers

I assume you mean "in Linq to Sql". Linq itself simply passes the LinqProvider expression, which translates it into something suitable for the requested data store.

However, I am sure that the MSSQL provider used by Linq to Sql will translate last_name >= "Smith" and last_name <= "Thomson"into an expression BETWEEN.

UPDATE: Empirical data (via LINQPad) indicates that it does not translate to BETWEEN

+3
source

, "" LINQ. , , .

+3

Source: https://habr.com/ru/post/1732573/


All Articles