I have a scenario where certain users must have the rights to update or delete certain records in production. What I want to do put in a safeguard to make sure they do not accidentally update or delete a large section (or entirety) of the table, but only a few records as per their need. So I wrote a simple
Tag: sql
Generate numbers 1 to 1000000 in MS Access using SQL
I am looking for a simple clean method to obtain the sequence {1, 2, 3, 4, 5, 6, 7,…,1000000} in MS Access SQL. I thought of creating a table with a column that numbers from 1 to 100000 however, this is inefficient. Is there a way of generating numbers 1 to 10000000 in MS Access using SQL? I tried the
How to run a string containing a static SQL query in PostgreSQL?
I have a function which generates a static SQL query and returns it as a string. What I need to do is to run the returned string as if I was typing it directly in psql. Here is a very simplified test case (the true mechanism is far more complicated but the following test case at least shows the idea)
Using REGEXP_CONTAINS with a list of substrings
I want to know if its possible to use REGEXP_CONTAINS with a list of substrings from a column in another table. Essentially I will have one table containing a list of substrings that I want to check against and I am using those substrings against the whole set of table names in a dataset. Below is the closest…
I have a double relation of the id of one table to another table and I need to build a relation with the same id in another table twice
I have this table id subOperation 1 test1 2 test2 3 test3 4 test1,test2 5 test1,test3 I need help, to make a query which gives me the following result id idSubOperation idElement 1 1 1 2 2 2 3 3 3 4 4 1 5 4 2 6 5 1 7 5 3 When I have one “,” I need
Need to lookup part data when there are multiple rows of the same part
I have a SQL Table that has parts with their own 2D barcodes. There may be multiple rows of the same part. Each row has a column with the Date_Time stamp. What I need is to get the latest part data and view one of the columns to see if that value is INT 1. Example below: Look up the
Joining two tables with same keys but different fields
I have two tables both all with the same fields Except for one. I want to combine these two tables with the resulting table having all the fields from both including the two fields that are not the same in each table. I.e: lets say I have table order_debit with schema and table order_credit with schema What I…
SQL Rows to column but NOT transpose
We have a table regarding identification where data is as such: Customer Number Identification 101 passport-us 101 Licence 102 passport-uk 102 Licence 102 birth-cert 103 Licence-learner Thus one customer may have submitted multiple identification others in varying number/combination. Result we are after is : …
SQLite – Select posts based on tags
I have two tables in my database: posts, which contains post id and other informations, and tags. In tags, there is a column post_id and a column tag. My idea is to store each tag in a separate row. For instance, a post with id 1 and tags foo, bar and eggs would be stored in tags as Which is
Extract nested data in JSON variable in SQL
I need some help extracting the data I need out of a JSON variable in SQL: I need to get management_account_id, Month and cost_to_client/details in a table, the problem I am facing is that the month is higher up on the hierarchy than the details section, so I’m going into each individual month to access…