Oracle sql query to group two sets of dates if sequencials

I have the next table: EMPLOYEE CODE START_DATE END_DATE 02097368 F7H3 09/07/2018 20/10/2018 02097368 F7H3 21/10/2018 05/01/2019 02097368 F7H3 06/01/2019 12/01/2019 02097368 F7H3 13/01/2019 02/02/…

Iterate an array using only select query in teradata

I’m trying to achieve the output table using the input table. The input table contains id and name where id has the numerical values and name contains JSON value. I can get the output by writing a …

PostgreSQL simply transpose/convert rows to columns

I read some SO posts like sql server 2008 r2 – Transpose rows to columns – Stack Overflow or sql – Postgres – Transpose Rows to Columns – Stack Overflow, but they are too complicated task to what I …

Is this possible to calculate this?

Is this possible to store the decimal type value in number column. 1/12 will be 0.083 and wants to store that in that column. create table test(number1 int,number2 int,number float) insert into test …

Select by code and if there is no result select any other

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”:…

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 …

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’),’…

psycopg2 sql.SQL: Composed elements must be Composable

import psycopg2 from psycopg2 import sql import datetime def connect(conn): “”” Connect to the PostgreSQL database server “”” # create a cursor cur = conn….