Skip to content

Tarik Billa

  • Web Development
    • html
    • vue.js
    • laravel
    • css
    • javascript
    • jquery
    • node.js
    • php
    • asp.net
  • Programming
    • python
    • java
    • c
    • c++
    • c#
  • git
  • android

sql-like

MySQL SELECT LIKE or REGEXP to match multiple words in one record

February 6, 2023 by Tarik

Well if you know the order of your words.. you can use: SELECT `name` FROM `table` WHERE `name` REGEXP ‘Stylus.+2100’ Also you can use: SELECT `name` FROM `table` WHERE `name` LIKE ‘%Stylus%’ AND `name` LIKE ‘%2100%’

Categories mysql Tags mysql, regex, select, sql-like Leave a comment

Use LIKE %..% with field values in MySQL

February 3, 2023 by Tarik

Use: SELECT t1.Notes, t2.Name FROM Table1 t1 JOIN Table2 t2 ON t1.Notes LIKE CONCAT(‘%’, t2.Name ,’%’)

Categories mysql Tags mysql, sql, sql-like Leave a comment

Escape a string in SQL Server so that it is safe to use in LIKE expression

January 29, 2023 by Tarik

To escape special characters in a LIKE expression you prefix them with an escape character. You get to choose which escape char to use with the ESCAPE keyword. (MSDN Ref) For example this escapes the % symbol, using \ as the escape char: select * from table where myfield like ‘%15\% off%’ ESCAPE ‘\’ If … Read more

Categories sql-server Tags sql-like, sql-server, stored-procedures, tsql Leave a comment

Use of SqlParameter in SQL LIKE clause not working

January 16, 2023 by Tarik

What you want is: tblCustomerInfo.Info LIKE ‘%’ + @SEARCH + ‘%’ (or edit the parameter value to include the % in the first place). Otherwise, you are either (first sample) searching for the literal “@SEARCH” (not the arg-value), or you are embedding some extra quotes into the query (second sample). In some ways, it might … Read more

Categories c# Tags ado.net, c++, sql-like, sql-server, tsql Leave a comment

Using Eloquent ORM in Laravel to perform search of database using LIKE

January 10, 2023 by Tarik

You’re able to do database finds using LIKE with this syntax: Model::where(‘column’, ‘LIKE’, ‘%value%’)->get();

Categories orm Tags eloquent, laravel, orm, sql-like Leave a comment

How do you force mysql LIKE to be case sensitive? [duplicate]

January 5, 2023 by Tarik

Use LIKE BINARY: mysql> SELECT ‘abc’ LIKE ‘ABC’; -> 1 mysql> SELECT ‘abc’ LIKE BINARY ‘ABC’; -> 0

Categories mysql Tags case-sensitive, mysql, sql, sql-like Leave a comment

Parameter in like clause JPQL

January 5, 2023 by Tarik

If you do LIKE :code and then do namedQuery.setParameter(“code”, “%” + this.value + “%”); Then value remains free from the ‘%’ sign. If you need to use it somewhere else in the same query simply use another parameter name other than ‘code’ .

Categories java Tags eclipselink, java, jpa, jpql, sql-like Leave a comment

LIKE operator in LINQ

January 2, 2023 by Tarik

Typically you use String.StartsWith/EndsWith/Contains. For example: var portCode = Database.DischargePorts .Where(p => p.PortName.Contains(“BALTIMORE”)) .Single() .PortCode; I don’t know if there’s a way of doing proper regular expressions via LINQ to SQL though. (Note that it really does depend on which provider you’re using – it would be fine in LINQ to Objects; it’s a matter … Read more

Categories c# Tags c++, linq, sql-like Leave a comment

SQL Server datetime LIKE select?

December 31, 2022 by Tarik

You could use the DATEPART() function SELECT * FROM record WHERE (DATEPART(yy, register_date) = 2009 AND DATEPART(mm, register_date) = 10 AND DATEPART(dd, register_date) = 10) I find this way easy to read, as it ignores the time component, and you don’t have to use the next day’s date to restrict your selection. You can go … Read more

Categories sql-server Tags sql-like, sql-server Leave a comment

How can I use ‘Not Like’ operator in MongoDB

December 23, 2022 by Tarik

From the docs: The $not operator does not support operations with the $regex operator. Instead use // or in your driver interfaces, use your language’s regular expression capability to create regular expression objects. Consider the following example which uses the pattern match expression //: db.inventory.find( { item: { $not: /^p.*/ } } ) EDIT (@idbentley): … Read more

Categories regex Tags mongodb, mongodb-query, pymongo, regex, sql-like Leave a comment
Older posts
Newer posts
← Previous Page1 … Page4 Page5 Page6 Page7 Next →

Tarik Billa

Software Engineer
tarikbilla@gmail.com
+8801884414000
  • Reuse a hash in YAMLApril 17, 2024
  • Dockerfile: how to redirect the output of a RUN command to a variable?April 16, 2024
  • How to cd to a directory with spaces in the directory name?April 16, 2024
  • Maximum MIME type length when storing the type in a databaseApril 16, 2024
  • What is the difference between Unit, Integration, Regression and Acceptance Testing?April 16, 2024
© 2026 Tarik Billa