3,265 questions
-1
votes
0
answers
97
views
Which index is useful on like clause? [duplicate]
SELECT o
FROM Order o
WHERE o.customerEmail LIKE %:emailPart%
are there any RDBMS (PostgreSQL) index type which can improve performance of the query above? (i.e. which index can help on like clause?)
0
votes
1
answer
127
views
Use of Pipe (Vertical bar) in SQL LIKE operator statements
I am looking to combine the following two LIKE string comparisons into one LIKE string comparison:
SELECT *
FROM dbo.Departments D
WHERE D.SystemKey LIKE 'SCI%'
OR D.SystemKey LIKE 'FOO%';
I have ...
0
votes
0
answers
44
views
i want to know how i search words or pieces of words in firebase in flutter, like i user comando "like" in mysql? [duplicate]
consider:
CollectionReference _dbCollection = FirebaseFirestore.instance.collection('estoque');
await _dbCollection.orderBy("descricao").startAt([_itemPesquisaController.text]).endAt(['${...
0
votes
1
answer
50
views
Mysql search with LIKE operator several words [duplicate]
I have a database structure like below
users
id | name
1 | Elizabeth Smith
2 | Smith Elizabeth
3 | Elizabeth Smith // extra space in between two words
4 | Dr.Elizabeth Smith
5 ...
0
votes
3
answers
60
views
How to combine LEFT and LOWER in a multicolumn index for leading text patterns?
I create an index this way:
CREATE INDEX rep_tval_idx ON public.rep USING btree (t, lower(left(val, 127)));
Then I run a SELECT with matching filter:
explain
select * from rep
where t=3 and lower(...
0
votes
1
answer
94
views
Find Invalid Chars in a Column [duplicate]
I am moving data from one system to another. The new system has a requirement that one of the columns can "ONLY have letters, numbers, hyphens and underscores". I need to find a way to see ...
0
votes
1
answer
60
views
Find procedure name in all other procedures
procedure 1:
create or replace procedure pro_1()
as
$$
begin
raise info 'pro1';
end
$$
language plpgsql;
procedure 2:
create or replace procedure pro_2()
as
$$
begin
raise info 'pro.1'...
2
votes
1
answer
62
views
MYSQL is very slow when combing LIKE with EQUALS or IN, but not other OR operators [duplicate]
SELECT
products.*,
products_description.*
FROM
products
LEFT JOIN products_description ON products_description.products_id = products.products_id
LEFT JOIN products_rooms ON ...
0
votes
0
answers
136
views
Inner Join using Like Operator in Big Query
I have a list of c.11k strings that I need to partially match to string IDs within a BigQ table.
T1 is the original BQ table and T2 is a table with a column of the 11,000 strings
At the minute I have ...
0
votes
2
answers
126
views
SQL like query contains only a specific character
I'm trying to get records from SQL server starting with abc_ followed by at least one letter (a-z, A-Z) and then continue to the end with just letters and numbers (a-z, A-Z, 0-9). No special ...
0
votes
1
answer
140
views
SQL SELECT * FROM table WHERE column NOT LIKE '%str% '
I have a SQL table where the last column is named flag:
name: type: collation: null: default:
...
flag varchar(250) utf8mb4_0900_ai_ci yes NULL
The data has either double ...
0
votes
0
answers
78
views
How to use NOT LIKE in SQL with a string of words
I am having trouble excluding text in a field that starts with "Community Launch". I am using the code:
rp.project_name NOT LIKE 'Community Launch%'
but this is removing any text that also ...
0
votes
1
answer
198
views
MySQL(5.7.26) query optimization, why select * is much faster that select id in my leading wildcard query?
I have a leading wildcard query I know it is hard to optimize. I know if I use only the trailing wildcard I can do some optimization. But our client wants the leading wildcard because when searching ...
0
votes
1
answer
87
views
How to combine Sequel.or with Sequel.like? (mssql or sqlite)
I use ruby and sequel in my programm.
I want to execute a deletion in my DB like
DELETE FROM db.tbl WHERE col1 = 'a' and (col2 LIKE '%xxx%' OR col2 LIKE '%yyy%')
But I fail to build the statement ...
4
votes
2
answers
938
views
MariaDB LIKE with Escape Character - Unexpected Behavior
I'm working on a Laravel application with a jobs table containing job data in the payload column. The payload is a JSON string similar to this:
{"displayName":"App\\Jobs\\V1\\...
0
votes
2
answers
41
views
Mysql LIKE or REGEXP
I am trying to select all the strings has word ABC1 in it. But getting wrong answer with LIKE query. Not sure how to get exact answer.
Below is the string format in a column:
"SomeString ABC1000 ...
0
votes
2
answers
102
views
Fastest way to compare two columns using like in two differents tables in MYSQL, half millions rows
I have a MYSQL database with a table 'product', about 500 000 rows, with a column 'oem' (varchar 255, utf8_unicode_ci). I have another table 'oem' with a column 'oem' too (varchar 255, utf8_unicode_ci)...
-1
votes
3
answers
117
views
Query that returns all words ignoring one
I have this table with the next records:
CREATE TABLE `t_vias` (
`id` int(11) NOT NULL,
`cpro` varchar(2) NOT NULL,
`cmum` varchar(3) NOT NULL,
`cpos` varchar(5) NOT NULL,
`mun` varchar(75) NOT NULL,
`...
0
votes
1
answer
66
views
SQLite: Matching All Items Within a List of Characters
I am working with a table (essentially a list of words, i.e. a dictionary'), and had the need to create a subset of items from that table that only contained 3 certain characters, let's say, 'A', 'P', ...
1
vote
1
answer
113
views
Postgres queries contaning non-alphabetical characters
I'm developing a search for entities by name in Postgres database. Name usually consists of 1-3 words and may contain symbols &, !, (, ), -, etc.
I'm using gin trigram index and queries: WHERE ...
0
votes
1
answer
86
views
Can '%VALUE%' be written so it gets current year automaticlly
The query looks like this:
Datatype for month.ty is text
month.ty LIKE '%2024%'
I am trying to make it get year without having to change it when year ends. Like get current year.
I have tryied with ...
1
vote
1
answer
134
views
mysql binary field lookup using LIKE has a problem
I have a problem with BINARY(16) type (ULID under the hood) and specific ULID 01HRS49374C1EAGTPKTJ0JVT1P (hex 018e32448ce4605ca86ad3d4812de836) when queried using LIKE. LIKE query works with other ...
-1
votes
2
answers
138
views
Match a pattern that does not contain a specific subpattern
I want to find the records that match a given text pattern but where a section of the pattern is different from a specific value. For example, a record of the Page table could have a PageId field and ...
1
vote
2
answers
536
views
Can partitioning be used for LIKE queries in Postgres?
I have huge words table which I'm running LIKE query on:
create table words
(
id int,
word varchar
)
It works pretty long. Index doesn't help a lot, so I'm trying to partition it by word column:...
0
votes
1
answer
41
views
Android Studio rawQuery with LIKE
This is my code but no results
String sqlQuery = "WITH Ranked AS (SELECT *, ROW_NUMBER() OVER(PARTITION BY " +
COLUMN_NAME + " ORDER BY " + COLUMN_NAME + &...
0
votes
1
answer
163
views
PostgreSQL - Difference in results between LIKE and '=' when using citext
On my DB, when querying
select my_field from my_table where my_field = 'ABC-123a'
it yields 0 results
but when querying
select my_field from my_table where my_field like 'ABC-123a'
it yields one ...
0
votes
1
answer
47
views
PHPMYADMIN - Phone is NOT LIKE other Phone in two Tables - Select `Phone` from `Phones1` WHERE `Phone` is NOT LIKE '%', `Phone` in `Phones2`
I am trying to do this in the phpmyadmin SQL query box on a cpanel shared server.
This works but, Local_Formatted in Phone1 and Phone2 tables are not always properly formatted.
...
-1
votes
1
answer
154
views
How to match length of field in like search in postgresql?
Hi I have a following query where conclusion_number column may include expertize_number with additional text. Thus I'm trying to find conclusion_number inside expertize_number via LIKE operator. ...
2
votes
2
answers
739
views
Using LIKE with ANY(array)?
select sum(case when '%sys%' like any(series_arr)
or 'displays' = any(lob_arr)
then revenue else 0 end) as sys_displ_revenue
from mytable
Basically, when I run this ...
0
votes
1
answer
68
views
R function for matching rows in dataframe to pattern in another dataframe and adding grouping variable
I am trying to create a function that will, for every row in a given dataframe, match a pattern with %like% to the contents of a column in that row and then paste a specific category name into the ...
0
votes
1
answer
147
views
Filter with like in BigQuery where the pattern are in an array
I would like to filter a column in bigquery where the LIKE should match multiple patterns. Something like:
SELECT description
FROM mytable
WHERE
mycol LIKE "%window%"
OR mycol LIKE &...
0
votes
1
answer
56
views
How to change this Access SQL to select similar rather than identical records
The following code works, as I type data the Dropdown is populated with fewer and fewer records until either only one remains, or I click to select a record from a small number of records. However ...
0
votes
0
answers
36
views
How does Containing affect MongoDB query performance?
I have the following query method.
findAllByProfile_UserIdContainingAndOrigin
There is an index for profile.userId but the query is extremely slow.
I suspect that because of the Containing keyword ...
0
votes
2
answers
127
views
How to show data with have most word in search
How can I show data with the most words in the search?
For example, I have a table like below:
No
Word
1
b c e f g h j k l
2
a b c d e f g h i j k l
3
a b d f g h i k l
4
a c d e f h i k l
5
a b c d e ...
1
vote
1
answer
595
views
In Power BI, how to return a list of rows from a table (or create a dynamic table) where text is found within a free text field in another table
I have a table, Defender, with a column, Device Name
I have another table, Defender SNOW, which has a column, Short Description (which is a text field).
The Short Description contains free text. I ...
-1
votes
2
answers
78
views
SQL query with "LIKE" [closed]
I'm trying to make a query and I don't understand why it doesn't work for me. I would appreciate it if someone could give me a hand
SELECT TEMA
FROM LIBRERIAS
WHERE TEMA LIKE '%IA';
This query does ...
-1
votes
1
answer
588
views
Best way to replace IN clause with LIKE or something equivalent
I have existing SQL like the following (this is a contrived example):
DECLARE @Var NVARCHAR(256)
SELECT @Var = SomeValue
FROM SomeTable
SELECT *
FROM AnotherTable B
WHERE @Var IN ('One','Two','Three'...
0
votes
3
answers
64
views
SQL - match part of a string with Column value
The user input the following string 2SMD4COMPUTEREH2KLD [free input]
what i need is to find the correct id in the table devices
The user input the following string 2SMD4COMPUTEREH2KLD [ ...
0
votes
0
answers
43
views
How do I use specify zero or more repeating groups in a T-SQL LIKE clause [duplicate]
I'm trying to pattern match something using LIKE. The below isn't my actual problem, but say I want one or more repetitions of a group of characters, for instance digits or comma (may be different ...
0
votes
2
answers
125
views
Multiple concat with like not showing the output in sql
I am using multiple concat with like but I am not getting all the output from the table. I am using below SQL query below in the database.
select
company_id as ID,
concat(
c.list_rank, '|||...
0
votes
1
answer
80
views
Why the result is different for SQL string equality and for LIKE operator in Postresql? [closed]
I have a table with login names. Login names does not contain any special character just [a-zA-Z0-9] and of type varchar(50).
I would like to find a user by login name eg.:
CREATE TABLE users( login ...
0
votes
1
answer
84
views
SQL LIKE with NCHAR returning records it shouldn't, why?
Why is the third row being returned even though it does not have the Unicode 8239 (narrow non-breaking space) in its contents?
DECLARE @tst as TABLE
(
col NVARCHAR(200) NOT NULL
)
INSERT INTO @tst ...
0
votes
1
answer
53
views
Efficiently Searching for Multiple patterns in a Text Column
I have a table with a text column that contains a description and a GUID for each operation. Each GUID can appear in a maximum of three rows.
I've been given a list of about 1000 GUIDs, and I need to ...
-2
votes
1
answer
696
views
Filter strings with fixed number of digits [closed]
I would like to subset a table where a string variable 'my_notes' contains exactly 10 digits phone number in MS SQL Server. I want something like
select *
from mytable
where my_notes like "%[0-...
0
votes
1
answer
93
views
How to create a flag from regular expressions in Microsoft SQL Server?
I have a dataset with IDs and a phone number as a string. I need to build a flag to show if the string is in a valid format.
Here's a dummy dataset.
CREATE TABLE Test
(
ID int,
Cell varchar(...
0
votes
1
answer
125
views
PervasiveSQL CONCAT not working in LIKE statement
I'm trying to build a dynamic LIKE statement, where the last 2 digits of the current year is passed into the LIKE part.
SELECT
COUNT(*) AS amount
FROM "ALLE" AS v
WHERE
(v.VMT != '' AND
v....
1
vote
0
answers
55
views
How to highlight the search keyword (inject html code) directly in the SQL results using prepared statements?
Edit : my question is not a duplicate of how to highlight search results since i am trying to work with the query and not the query results. I know i could work with the query result and i even tried, ...
1
vote
1
answer
75
views
Mysql : Select query with like
I have this kind of data in my database "mydb" :
id | name
---------
1 | abcdef
2 | bcdefg
3 | cdefgh
4 | defghi
5 | efghij
I do a simple SELECT query like this one :
SELECT * FROM ...
1
vote
1
answer
100
views
CHECK constraint matching beginning of value
We are using sqlite3 for a database and ensuring values inserted into a column matching a specific string would be useful in our case.
Example:
CREATE TABLE people ("firstname" TEXT),
CHECK(...
1
vote
1
answer
78
views
slow live search on the page (MySQL InnoDB)
There is a live search on my page. When sending a request to the server, filtering and sorting parameters are accepted (developer, publisher, genre, time, etc.). The problem is that its execution ...