I found a very similar topic on Oracle Equivalent to MySQL INSERT IGNORE? However, I could not make work any of the proposed solutions. My case is a little special as my table does contains only 1 field, which is the primary key. Let’s call the field “id” and the table “myTable” …
Tag: sql
How to use named parameter in plain sql with jooq
I’m using JOOQ with plain/raw SQL, so that means i’m not using any code generation or the fluid DSL thingy. The following code works: Now let’s say i have a query with multiple parameters like this: How do i use a named parameter with these types of queries? I’m thinking something like…
Combining the results of two SQL queries as separate columns
I have two queries which return separate result sets, and the queries are returning the correct output. How can I combine these two queries into one so that I can get one single result set with each result in a separate column? Query 1: Query 2: Thanks. Answer You can aliasing both query and Selecting them in…
SQL “between” not inclusive
I have a query like this: But this gives no results even though there is data on the 1st. created_at looks like 2013-05-01 22:25:19, I suspect it has to do with the time? How could this be resolved? It works just fine if I do larger date ranges, but it should (inclusive) work with a single date too. Answer It
How to select distinct year from a datetime column and add the result to a comboBox in C#?
I am using visual studio 2010 and SQL Management Studio R2 Although the sql query works fine in sql management studio. Its throws an exception in visual studio. Out of index exception whem i edit to make any other adjustments it throws Out of format exception. Please Help me. The code is as follows: Answer Yo…
REGEXP_LIKE conversion in SQL Server T-SQL
I have come across this line in an old report that needs converting to SQL Server. examCodes being the source and learner_code being the pattern. I know that SQL Server doesn’t have REGEXP_LIKE and most places tell you to use PATINDEX. Here’s me thinking that this would work: But I get the error: …
sqlalchemy,creating an sqlite database if it doesn’t exist
I am trying out sqlalchemy and i am using this connection string to connect to my databases Does sqlalchemy create an sqlite database for you if one is not already present in a directory it was supposed to fetch the database file?. Answer Yes,sqlalchemy does create a database for you.I confirmed it on windows…
Using field in CASE without group by
I have the following code and I am having trouble figuring out how to NOT include these into the group by. Some of the arguments are purely for the case and that is all. I can’t include them in the group by. I cam’t really group by anything else as I need to get the counts by TransactionTyp only b…
How to find third or nᵗʰ maximum salary from salary table?
How to find third or nth maximum salary from salary table(EmpID, EmpName, EmpSalary) in optimized way? Answer Use ROW_NUMBER(if you want a single) or DENSE_RANK(for all related rows):
Generating dates between two dates
I need to generate all dates between two given dates. This works fine as long as there is just one date range. However, if I have multiple date ranges, this solution doesn’t work. I have searched here …