I am having a little trouble with this query. I want to filter my Features down for all features that have applicabilities that have include the name ‘G6’, but that also do not have a many to many relationship with applicabilies that have the name ‘n2’. I have right now: I have a many …
Flutter SQLlite the argument type ‘Future’ can’t be assigned to the parameter type ‘String’ error
I have copied and modified a bit the code from this official tutorial: https://flutter.dev/docs/cookbook/persistence/sqlite My version of the insertion looks like this: final Future …
How to insert and delete from and to the same table in the same query?
Is there any way to select something from table A then delete & insert those records from/to table B (kind of updating B with values from A)? Let’s say I have two following tables: I came up with this: This is working expect when it fails for “duplicate key value” error. However I though…
Searching with a lateral join extremely slow
I’m currently implementing a search function in one of our grids and when doing so, my query goes from running in 1 second or less to running in about 16 seconds (I’ve added suggested indices, etc). The data returned from this query will be the parent’s id, parent’s name, most recent c…
SQL query to group items with their quantity then show a total quantity
I have the following data that I’d like to rearrange using an SQL query: I’d like to group the same order_id to show it like the following: 99996 | 63 – 2, 62 – 2 | 4 So that’s looking for the items in the same order, showing the product id and quantity, then showing the total of…
SQL / Hibernate insert only if url not exists
I have a list of urls and a table that contains urls. I want to only insert if the url is not in the table. After the insert the Data-table should be contain: My current attempt is to have a method findByURL(url):List and a call this method for every URL in the list. If the returned list is empty I
Best way to insert into multiple tables in a cluster
Suppose I have a wide table (CUSTOMERS) that contains lots of columns (CUSTOMER_ID, FIRST_NAME, LAST_NAME, DOB, ADDRESS, PHONE_NUMBER, etc). This table is used in several full table scans, each of which selects only a small number of the columns of the table. Since this table is very large, these full table s…
Order SQL results where each record referencing another record on the same table comes after the referenced record
I have the following data: Where parent_id is a reference to the SAME table. I need to sort these columns so that each record is after its parent (not necessarily immediately after). So I would expect this result: I’m guessing there is no clean efficient way to do this without any significant schema cha…
Count occurrences in SQL
I have a table with the following data And I would like to have for each ID how many occurrences of each type there are Is there a way in SQL (something like a pivot table) Answer I would recommend conditional aggregation. This is a cross-database solution that is more flexible than vendor-specific solutions …
Passing Multiple Values To PL/SQL Input
I have an Oracle package which contains a function. This function has 3 inputs. I need to pass multiple values to each input. I could automate a process which runs it multiple times with each combination of variables but I would like to only make one call to the database. Simplified Code Answer Pass it with q…