I have a MySQL table like below: | ID | userIDs ————— | 1 | 4,3,5 | 2 | 2,3 | 3 | 1,2,3 I want to retrieve all the rows in which userIDs doesn’t contain 1. I tried SELECT * …
explain differences between two different updates
I have 2 different update queries, one I created: my colleague preferred this one: He can’t explain which one should be better and neither can I. The only difference I have, is that the update on the second query crashes when there are no results to update. Can anyone explain what’s the difference…
How to use LIKE with ANY in Postgresql?
Is there a way to do a partial string match on a string array column in postgres? I’m trying the following syntax, but it is not working as I’d expect it to: Is there a correct way of doing this? Answer
jOOQ: Mocking DAO objects
jOOQ 3.5.0 I’m currently trying to write unit tests for a resource that is using jOOQs generated DAO objects. I’ve noticed one of the base classes (DAOImpl) in the DAO hierarchy has many final methods which makes it unfriendly to mock (I’m excluding byte code manipulators like Powermock as a…
How to get only specific record from multiple tables?
I have tables ‘table1′, ‘table2’,’table3′ and ‘table4’ . ’table1’ has a column ‘account’ on basis of I need to get record from ‘table2’ or ‘table3’ or ‘table4’ with respect of another column ‘user_id’….
Compare row count of two tables in a single query and return boolean
I want to compare row count of two tables and then return 0 or 1 depending on whether its same or not. I am thinking of something like this but can’t move ahead and need some help. I am getting multiple rows instead of a single row with 0 or 1 Answer you have to remove : Otherwise it will
how to set N prefix before sql parameter
i writed a query like this: SELECT [FirstName], [LastName] FROM [WorkersView] WHERE ([FirstName] LIKE ‘%’ + N’علی’ + ‘%’ ) AND ([LastName] LIKE ‘%’ + N’مسروری’ + ‘%’) and it’s work very well! and …
Running sqlplus in background in Unix
I am trying to run an .sql file from sqlplus in Unix environment as a background process. I am connecting to Unix using Tectia or Putty, and I want sqlplus to continue running in background even if my terminal closes. This command works but when trying to start it in background it fails What is the right comm…
PostgreSQL, SELECT CASE COALESCE
I need to ‘name’ categories: mycat is a text column with possible values ‘0’ to ‘4’. That works OK, but I have some an error in my program which very rarely writes null (or ” as I can see in pgAdmin). In such cases I have to treat that ” the same as ‘0R…
How to use variables in “EXECUTE format()” in plpgsql
I want to update a column in table stats with the specific column being a parameter, then return the updated value of that column [only has 1 row]: CREATE FUNCTION grow(col varchar) RETURNS integer …