Questions tagged [like]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
2answers
59 views

like in exist() xml mssql

By following question: See if XML element exists at any level in document with a specific value Is there a possible solution to implement like clause within exist? For example I have similar structure ...
-3
votes
1answer
35 views

SQL QUESTION_Case When + LIKE % [closed]

I get an error but I don´t understand why. Does this make sense in SQL? I need the column ValidNaming to be filled with False/True if the customer (or field CommonLastName) has an invalid name. Why ...
1
vote
2answers
29 views

Return results with several LIKE and NOT LIKE requirements

I am trying to create a query that selects only a set of values, but excludes other ones. The column I am selecting it's called "Participants" and the values therein are not a single text ...
1
vote
0answers
27 views

Search by first and last name of the Instructor

I have the below tables in the MySQL database create table course_class ( id varchar(36) not null primary key, class_code varchar(255) not null, ...
0
votes
1answer
182 views

Find partial match with textsearch query

I have the following query that I did hard looking on this site: SELECT * FROM renns WHERE ( to_tsvector('english', coalesce(numar_admin, '')) || to_tsvector('english', coalesce(...
0
votes
1answer
249 views

How to filter a character followed by numbers string pattern in PostgreSQL?

Back in SQL Server, I use the command below to get the matching string pattern of #1234 from the column called Number SELECT [m].[Number] FROM [Boats] AS [m] WHERE [m].[Number] LIKE N'[#][0-9][0-9][0-...
0
votes
1answer
33 views

SQL Server 2017: OR and LIKE Interaction

I am using SQL Server 2017 (i.e. v14). I could use one of the following equivalent criteria in a query: x IN ('104','504','554') (x='104' OR x='504' OR x='554') (x='104' OR x Like '5[05]4') If I use ...
1
vote
1answer
108 views

Count numbers in scientific notation (E-notation)

I'm trying to check if a part number field has scientific notation values and came up with this simple solution: SELECT count(*) as overall, count(*) filter (where partnumber ilike '%E+%') as ...
1
vote
1answer
828 views

Postgres HAVING ilike any wildcard in array_agg

I need a filter where the input value is similar to any value in an aggregate, using ilike and wildcards. My attempt at a query so far is: SELECT p.id, p.name, array_agg(vo.name) FROM product p LEFT ...
0
votes
1answer
36 views

Mysql, Getting all rows in which field ends in a specific character, and another field exists that is the same but doesn't end in that character

I need to get all rows which end in a specific character, P for example, but in which a similar key sans the P exists. I have no idea how to approach this one in MySQL. This is very small example, my ...
-1
votes
1answer
25 views

Comparing the result of a subquery with LIKE

I need to find all the movies that have all of its actors' names to start with an A and have a 60.000.000 or more of gross. I have this but is not working SELECT title, imdb_score FROM Movie AS m ...
1
vote
2answers
2k views

Case insensitive LIKE in DB2

Is there a way to do a LIKE operation in DB2 against a varchar column in a case insensitive way, without changing the underlying column definition? Or is there a workaround like SELECT * FROM mytable ...
0
votes
3answers
2k views

MySQL LIKE IN with Input Parameter of stored procedure Comma Separated Values

I am creating a stored procedure to search user's Towns. From the User Interface user will select multiple towns that will be sent to the stored procedure. Sample input of the towns parameter for the ...
1
vote
2answers
61 views

Find rows in a single table where values in a certain column are near-duplicates

I have a Postgres 11 table on RDS containing a column email; some of the values in this column [and only that column] are clearly de facto duplicates but differ in case, i.e., different capitalization,...
3
votes
1answer
392 views

SQL query with Like operator with Leading Wildcards

I have a query as follows: select top (30000) * from table1 where licenseplate like '%as43bv%' I have an index on licenseplate but the query will not hit the index due to leading wildcard. Since ...
3
votes
1answer
49 views

Closing bracket ']' in LIKE wildcard

I have a query that looks a bit like this: SELECT * FROM Stuff WHERE name LIKE '[a\]]%' My goal is to match all names starting with a or ] (closed bracket). However, this seems to match everything ...
-2
votes
1answer
30 views

Should I use the LIKE predicate or fetch all rows and process them on the client?

I am optimizing my application, while this task, I find one query which is fetching data from database using like . and database rows are around 10000. So is this a good way to use like in query or I ...
6
votes
4answers
2k views

Counting occurrence of words in table is slow

Consider these simplified tables: CREATE TABLE dbo.words ( id bigint NOT NULL IDENTITY (1, 1), word varchar(32) NOT NULL, hits int NULL ) CREATE TABLE dbo.items ( id bigint NOT NULL ...
4
votes
1answer
308 views

T-SQL LIKE Predicate failed to match with whitespace in XML converted varchar

Recently I attempt to search for a particular pattern by converting XML data into varchar(max) although I'm aware it's not the best practice and found out it's not working as expected:- Setup ...
0
votes
1answer
39 views

Planning and Optimizing the table structure InnoDB MySql

I am planning to have an InnoDB MySql table with tens of millions of rows. Each row represents a record that can belong to AT LEAST one of 200+ categories. Most of the records will belong to 2 or ...
1
vote
1answer
472 views

How to search id from one table in another table's nvarchar column

I have 2 tables table1 ( id int, name nvarchar) table2 ( pid int, parameters nvarchar) parameters in table2 contains table1.id in nvarchar format, like "some text 12345 some text", where 12345 is ...
1
vote
1answer
3k views

Can a Postgres LIKE statement return an exact match?

I'm trying to search a Postgres table using LIKE and %, but the query is not returning results. The column local_username will contains values formatted like: username@domain.local OR username@domain....
0
votes
2answers
247 views

SSRS - select where parameter and fixed value

So there is a lot of stuff about using SSRS parameters to select multiple values but nothing about using both a parameter and a fixed value using the in select statement. So what I'm trying to do is ...
15
votes
4answers
71k views

How to do a case-insensitive LIKE in a case-sensitive database?

My vendor requires the data warehouse database to be case sensitive, but I need to do case-insensitive queries against it. In a case-sensitive database, how would you write this to be case-...
-2
votes
4answers
184 views

What is the implicit ordering of a LIKE condition?

I would like to know how the LIKE operator is classified, I have a query where I have a number of chained LIKE statements. How are the results from the following prioritized when they're returned? ...
1
vote
1answer
113 views

Join tables based on variable value contained in column

I have two tables with dates as the primary column to join. But, I also need to join based on the value from one column that is partially contained in a column from the other table. Table 1: date, ...
1
vote
2answers
2k views

Slow query performance when searching for a particular value, but fast with a different value on the same column

I have a SQL Server 2017 select statement that is executed by the front end application. The query has three joins and UNION. Each join statement has a clause where NAME LIKE '%ibm%'. When I change %...
0
votes
1answer
88 views

Just 4 Table Join query takes too much time and some time fail to execute

I am working on getting candidate detail from mysql database and for that i have created one query. Is my query structure is wrong? Here is the query: SELECT `candidate`.`id`, `candidate`.`email`,...
1
vote
1answer
4k views

Postgres collate example in select?

I would like to comprehend the different behavior of like and =. Sadly, I can not reproduce the following simple example thus that both queries return a different result: SELECT 'ä' LIKE 'ae' COLLATE ...
5
votes
4answers
13k views

ERROR: operator does not exist: text[] ~~ text

We have an easy syntax that allows us to look into an array for a single scalar, SELECT 'foo' = ANY(ARRAY['foo', 'bar', 'baz']); We can use the same method to match with LIKE SELECT 'foobar' LIKE ...
1
vote
1answer
2k views

Using LIKE to search case insensitive over language specific characters (PostgreSQL)

Using a PostgreSQL database (Collation C, Encoding UTF8) we store data from various languages. This means we also get the special characters for free (e.g. Å, å, ...) Within an application we now ...
1
vote
2answers
2k views

Return results that contain or do not contain punctuation

Is there a way within MySQL to return results using a LIKE statement that contain or do not contain punctuation characters such as apostrophes and hyphens? For example if I have one of the following ...
1
vote
2answers
272 views

SQL regex PostgreSQL

Let's consider a table like that: id | name 1 | This is a test sentence 2 | is a sentence TeST 3 | This a IS test sentence 4 | iS a tEst sentence tHis 5 | This a test sentence is How ...
0
votes
1answer
143 views

Search for the root words using root words with prefixes or suffixes

Is it possible to search the word "FILL" saved in the SQLite database using the words "REFILL" or "FILLED"? Not just these words specifically but you get the idea of searching the root word using the ...
0
votes
3answers
931 views

Postgressql text search: pg_trgm index with order by going very slowly

I have a really slow query(~30 seconds) on a large text search DB that I could really use some help with. I'm searching for ordered text, in a long file path string. So the path could be: folder1/cat ...
13
votes
3answers
962 views

Overcome LIKE character length limitation

By reading this LIKE character length limitation here, it looks like I can't send a text longer than ~4000 characters in a LIKE clause. I'm trying to fetch the query plan from query plan cache for a ...
26
votes
1answer
12k views

Why does searching for LIKE N'%�%' match any Unicode character and = N'�' match many?

DECLARE @T TABLE( Col NCHAR(1)); INSERT INTO @T VALUES (N'A'), (N'B'), (N'C'), (N'Ƕ'), (N'Ƿ'), (N'Ǹ'); SELECT * FROM @T WHERE ...
2
votes
2answers
187 views

JOIN on LIKE when input udtt count is > 1

This query accepts a User-Defined Table Type variable and then joins that with a table. If the input is a single record, I want the join to be LIKE '%'+input+'%', otherwise it should be =input. This ...
17
votes
5answers
270k views

Select multiple values in LIKE Operator

I have a SQL query given below, I want to select multiple value using like operator. Is my Query correct? SELECT top 1 employee_id, employee_ident, utc_dt, rx_dt FROM employee INNER JOIN ...
1
vote
1answer
1k views

Postgres won't use btree index in left-anchored LIKE query [duplicate]

Using Postgres 9.5. The Postgres documentation says that the btree index can be used for left-anchored "like" queries (i.e. "%" only at end). But my left-anchored "like" queries on a 1 billion row ...
1
vote
1answer
736 views

Table indexes for autocomplete in MySQL

I need to implement an "autocomplete-like" query in MySQL, one on a fairly short textual field varchar(11) and one on a potentially long field varchar(140). As they are autocomplete query, they will ...
-2
votes
2answers
295 views

How to improve a simple LIKE on large tables

I have a business facing web application that runs on MySQL that runs a query like this on certain pages. SELECT event_user, event_type, event_details FROM `event_history` WHERE `event_details` ...
0
votes
1answer
10k views

SQL server Like pattern match with CONCAT() always fails

I am facing problem in a simple query script for SQL server. Please help The script is CREATE PROCEDURE [dbo].[Search_By_Author_And_Name] ( @Author_name AS [varchar](50) ) AS BEGIN Select B....
4
votes
1answer
4k views

Repeating pattern X amount of times in LIKE

I took a look at the documentation for patterns from Microsoft (can be found here), and from what I understood, it doesn't say a way for a pattern to repeat a limited number of times. It's either the ...
7
votes
3answers
3k views

Matching left and right single-quotes used as apostophes

I have four columns containing names and want to search these using a LIKE in a Microsoft SQL Server environment. The complication comes that names may include left and right single-quotes / angled ...
5
votes
1answer
348 views

StartsWith query using LIKE is returning the wrong results on a non ascii column

I want to query a table for entries that begin with a specific fragment of text. I am under the impression that the LIKE operator is a way to do this, so if I wanted to find all rows that have a ...
0
votes
2answers
469 views

Using LIKE with apostrophes

I have been running a server side trace in order to find out how a specific stored procedure is called within my database. I am running the following query in order to get data from the trace file ...
1
vote
4answers
3k views

Update data of one table from another with comparing columns have same initial strings

I have two tables: NewData: EName Job Sal smith clerk 2000 allen sales 2000 jones.domain.com Manager 6000 OldData: EMPNO ...
1
vote
1answer
51 views

Limiting the input to a field as some pattern

i have a table student having field admission no. i want to restrict its input to the pattern '-/----/--'. If the input does not match this format then it should show an error. I tried doing this ...
0
votes
1answer
1k views

MySQL - Like with index

I found many question, But no solutions. An index can not be used to speed up queries where the search criteria starts with a wildcard: LIKE '%text%' An index can (and might be, depending on ...