Imagine there are some table with some data: id | code | name —————- 1 | 0001 | qwer 2 | 0002 | rtyu 3 | 0003 | asdf There can be only one record with code == 0002. Also it may be absent….
How to select JSON property in SQL statement?
I have field of type json. Example value is: [{“id”: “960287”, “src_ip”: “X.X.X.X”, “filename”: “XXX-20200408092811-0”, “order_id”:…
Split string value and use in INSERT and UPDATE command
I Implemented a small ERP system for our kitchen. The system is used to track our groceries, so it contains the goods (referred as food) with its name and UPC code. Over the time the names and upcs started to overlap and creating a data problem. In a first attempt we started to add the manufacturer into the n…
Student Taking More than One Class In Moodle
I have tried to do some research but all the answers dont quite address my simple problem. In my Moodle Course database I do a SQL Query to see what student completed a class within a 24 hour period. …
Creating a trigger that records modifications on table A by inserting values in table B
I’m having problems with the following trigger that records when an insertion with attribute ‘numero’= 4 is made on table A by inserting into table B who made the modification and the number of …
My sums are way too huge, is it not possible to do them all at once?
I have a table with colleague info, including their IDs, and a separate table with transaction data (such as revenue). In the transaction table, there are three fields (code1, code2, code3), they could be blank, or have colleague IDs, etc. I have no control over these tables. I am trying to accumulate some su…
Convert Timestamp to minutes in Oracle after a subtraction
I’m trying to get the minute value from a Timestamp after a subtraction First I made a subtraction: Current Time – Target Time(INSP_FIN_DT) ( TO_TIMESTAMP(TO_CHAR(SYSDATE,’YYYY-MM-DD HH24:MI:SS’),’…
Ignore SQL INNER JOIN if specific record exist?
i got two table joined like this I want to display results of two table joined but with condition if the status of TableB has anything in (‘CO’,’CL’) the whole join with id of TableA would be ignored not just the rows with status not in (‘CO’,’CL’). A.id and A.T…
Pivoting a string from a table function in different columns
I have a task to create a table function that receives a string and sorts it into different columns. The string itself may vary, but the columns are supposed to be the same always. The string is: ‘100^TEst¬200^TEst2¬300^Test3’, but for example if I add “¬400^Test4” that should be in th…
MySQL-condition on partition size
table1 has 3 columns in my database: id, category, timestamp. I need to query the newest 3 rows from each category: now I need to add one more condition: select only from the partitions which have at least 3 rows. how to add this condition? Answer here is another way: