sql-like

Get rows that contain only certain characters

我是研究僧i 提交于 2021-01-29 01:56:40
问题 I want to get only those rows that contain ONLY certain characters in a column. Let's say the column name is DATA. I want to get all rows where in DATA are ONLY (must have all three conditions!): Numeric characters ( 1 2 3 4 5 6 7 8 9 0 ) Dash ( - ) Comma ( , ) For instance: Value "10,20,20-30,30" IS OK Value "10,20A,20-30,30Z" IS NOT OK Value "30" IS NOT OK Value "AAAA" IS NOT OK Value "30-" IS NOT OK Value "30," IS NOT OK Value "-," IS NOT OK 回答1: Try patindex: select * from( select '10,20

how to join, if the text contains

拜拜、爱过 提交于 2021-01-28 08:10:10
问题 I have 2 tables, say table A has 10 rows and table B has 100 rows and I want to perform a join, but the matching condition has to be where a column from A 'is like' a column from B meaning that anything can come before or after the column in B: For example: if the column in A is 'foo'. Then the join would match if column in B is either: 'fooblah', 'somethingfooblah', or just 'foo'. I know how to use the wildcards in a standard like statement, but am confused when doing a join. Does this make

Laravel - LIKE operator to search for encrypted values

喜欢而已 提交于 2021-01-27 23:03:44
问题 I am trying to implement a search module in my Laravel app that could filter users by name. In order to protect users, the 'name' column rows are encrypted on DB. The problem that I am facing is that query below always returns 0 results. I am encrypting the search input value before searching into DB. $patients = DB::select( DB::raw("SELECT * FROM patient WHERE name LIKE '%".Crypt::encrypt($searchText)."%';")); What am I doing wrong here ? 回答1: Crypt::encrypt("Text") The above will rarely

Laravel - LIKE operator to search for encrypted values

ぃ、小莉子 提交于 2021-01-27 21:36:33
问题 I am trying to implement a search module in my Laravel app that could filter users by name. In order to protect users, the 'name' column rows are encrypted on DB. The problem that I am facing is that query below always returns 0 results. I am encrypting the search input value before searching into DB. $patients = DB::select( DB::raw("SELECT * FROM patient WHERE name LIKE '%".Crypt::encrypt($searchText)."%';")); What am I doing wrong here ? 回答1: Crypt::encrypt("Text") The above will rarely

Using like operator to check for pattern in hive

↘锁芯ラ 提交于 2021-01-22 10:15:06
问题 I need to retrieve the columns from a hive table that must begin with uppercase letter and end with digit. I used this query select * from tab1 where col1 like '[A-Z]%[0-9]'; But not able to retrieve the records ,getting only empty result. 回答1: rlike / regexp select * from tab1 where col1 rlike '^[A-Z].*[0-9]$'; 来源: https://stackoverflow.com/questions/42809183/using-like-operator-to-check-for-pattern-in-hive

Using like operator to check for pattern in hive

僤鯓⒐⒋嵵緔 提交于 2021-01-22 10:10:43
问题 I need to retrieve the columns from a hive table that must begin with uppercase letter and end with digit. I used this query select * from tab1 where col1 like '[A-Z]%[0-9]'; But not able to retrieve the records ,getting only empty result. 回答1: rlike / regexp select * from tab1 where col1 rlike '^[A-Z].*[0-9]$'; 来源: https://stackoverflow.com/questions/42809183/using-like-operator-to-check-for-pattern-in-hive

Using like operator to check for pattern in hive

隐身守侯 提交于 2021-01-22 10:07:13
问题 I need to retrieve the columns from a hive table that must begin with uppercase letter and end with digit. I used this query select * from tab1 where col1 like '[A-Z]%[0-9]'; But not able to retrieve the records ,getting only empty result. 回答1: rlike / regexp select * from tab1 where col1 rlike '^[A-Z].*[0-9]$'; 来源: https://stackoverflow.com/questions/42809183/using-like-operator-to-check-for-pattern-in-hive

how to use Like statement to get encrypted value from a table in mysql?

做~自己de王妃 提交于 2021-01-06 11:31:26
问题 how to use like statement in encrypted column in mysql i need to get user id from a table where username is like some value(user given input). but my username column is locally encrypted and stored in DB. Now, how to get the decrypt value from DB for using like statement. i am using Like statement in search method to get the values from the table that matches it, but values are encrypted in table. For example: vi - 68726rgur4746r279267(encrypted type first name in db). when i type vi in the

SQL SELECT WHERE string ends with Column

流过昼夜 提交于 2020-12-04 15:33:02
问题 I have this table in SQL Server 2012: Id INT DomainName NVARCHAR(150) And the table have these DomainName values google.com microsoft.com othersite.com And this value: mail.othersite.com and I need to select the rows where the string ends with the column value, for this value I need to get the row no.3 othersite.com It's something like this: DomainName Like '%value' but in reverse ... 'value' Like %DomainName 回答1: You can use such query: SELECT * FROM TABLE1 WHERE 'value' LIKE '%' +

SELECT * FROM table WHERE (all_columns_begins_with: name%) = Bob

徘徊边缘 提交于 2020-11-29 10:33:46
问题 I have a SQLite table with columns like these: id, name_1, name_2, name_nick, phone, email and I am looking for a way to search in all columns which begins with name_ . Like LIKE but for the column names. I find a lot for MySQL etc, but nothing for SQLite. These queries do not work as I want: SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = N'Customers' SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE table_name = 'Foods' AND table_schema = 'YourDB' AND column_name LIKE