I am able to manually execute the following code: However, if I try creating a Trigger with the same code as above, I get this error when creating a new user in my database: Can’t update table ‘members’ in stored function/trigger because it is already used by statement which invoked this sto…
Tag: sql
how to select the max of COUNT(*) (SQL postgresql)
I switched from NOSQL to SQL and i can’t find how to select the max of count(*) i created users table, posts and comments. i want to select TOP 10 users with the max of posts and max of comments Answer First, using SQL database require you to define the JOIN statement between the associated tables to ge…
WooCommerce sql query to find products with a specific meta key and meta value
I am trying to get products with a custom field with value condition from DB. Custom field is named: “_filtered_product”. I want to get products only with value = 1 This is SQL query I have written. Answer Not sure why you want to write your own sql query for this simple task, while you could use …
how to sanitize sql.js inputs?
I am using sql.js to manage the SQLite file I created for an electron app. My issue is that I want to make sure all the inputs are sanitized. As of now, I am using statements like so: I’m pretty sure that this way is unsafe and can cause SQL injections. What can I do to prevent such a problem?
As a result of the Euclidean distance many images are mistakenly identified as identical
Sorry for my bad english, i have a small database that contains hashes of photos, when I try to find similar photos to the one below: for which the following hash was calculated: “0f3f2764ecc482c2” using the method average_hash() The system finds a very large number of collisions, below is an exam…
How to convert X items into array and looping
I have a table with 100k records. I want to create an array for each 10k items and loop this, i.e. first 10k items-> array(first 10k items), then seconds array(10k different items), then third and so on. In other words, each array contains 10k different records. This is what I tried: This is the error I ge…
Spark: How to transpose and explode columns with dynamic nested arrays
I applied an algorithm from the question Spark: How to transpose and explode columns with nested arrays to transpose and explode nested spark dataframe with dynamic arrays. I have added to the dataframe “””{“id”:3,”c”:[{“date”:3,”val”:3, “…
Find duplicate values in a field results in multiple rows of the same values
Suppose this table I want to get all CODEs where SIZEPOS has the same value more than once… So for the product I would like to get ‘194342-01’, 10510, 5 as SIZEPOS 5 appears twice. I achieved it with the following query but for some reason some of the returned rows appear twice, or even thre…
List the discharged patients who were earlier admitted but did not undergo any operation
This is my code and everything is correct excepted the average temperature since the results are shown that everyone got the same temperature. exp:student a got 4 times observation of temperature whereas student b only got 1 time of observation. so how can I deal with it? Answer This is essentially a complete…
Unable to log into Azure SQL database in Azure Portal using AAD Global Admin (member type) account
I am Global Administrator of the Azure subscription I own. Steps: I logged into Azure Portal using my credentials. I created an Azure SQL database (including initiating a new Azure SQL Server instance). I set the database security to permit both SQL Login and AAD Auth. I set my AAD account to be SQL Admin of …