Consider the following code, where dbContext is a SQL Server database context and Examples is a DbSet: The first line works as expected and is converted to SQL in the following manner: However, the second line first fetches all rows and applies the Take operator afterwards. Why is that? Since I am using expre…
How can I read a very long BLOB column in Oracle?
I want to connect a Node Express API with an Oracle 11g Database which has a table with a BLOB column. I want to read it using a SQL query, but the problem is that the BLOB column can have a very long …
CTE function with insert statement
I have 2 queries and I need to combine them into one query with an insert statement. This is my first query that already has an insert statement: with q as ( select s.department ,s….
How do i resolve this trigger in pl/sql?
I want to have a trigger that no more than 3 employees work on a given project this is the code that i have but doesn’t work very well, sometimes work and sometimes doesn’t work. create or replace …
SQL: How do I get a filtered count for each distinct row in a table?
Note: this is different from questions that ask “I want a count for each distinct row in a table” which has been answered numerous times. This is a filtered count, so the counting part of the query …
SQL show available, reserved and cancelled seats
Basically, I need to show the number of reserved , cancelled and available seats for a train. I have this for the available seats: SELECT t.trainid, t.maxcapacity – coalesce(sum(b.numseats), 0) …
Count records per month with condition
I have a table, let’s call them SUMMARYDATA NIP NAME DEPARTMENT STATUSIN STATUSOUT LATECOME —————————————————————————-…
Selecting different parameters for a group by statement in mysql?
I have a dataset like this: Here in this dataset, there is No NULL value for all these 3 columns, also user_name and recording_msid pair can repeat but each repeated pair will have a distinct …
REPLACE not removing the correct characters
Here is the query : SELECT ‘,’+ REPLACE(wo_note, ‘ ‘, ”), basically I want to remove the characters ‘amp;’ but it does remove it when I am entering it, SELECT ‘,’+ REPLACE(wo_note, ‘amp; ‘, ”) I …
How to filter by comparing the dates in MySQL Workbench
I have a table look like this: ID B C date01 date02 date03 11 xxx xxxx 2020-05-01 2020-05-02 2020-06-02 11 xxx xxxx 2020-06-01 2020-06-03 2020-05-02 11 …