Check for overlapped dates on any row of a table Oracle SQL

I have the following schema: CREATE TABLE EPOCA ( ID INT CONSTRAINT PK_EPOCA PRIMARY KEY, NOME VARCHAR(250), DATA_INI DATE CONSTRAINT NN_EPOCA_DATA_INI NOT NULL, …

Create date table of every second between two dates

I need to create a table of every second between two input dates eg between 01/01/2015 00:00:01 and 05/01/2016 00:00:00 So a 3m row expected output that looks like this: Does this need a CLR? …

Why do I get a conversion failed error when I use my attribute on my WHERE clause but it works when I don’t?

Why is my query returning a result when I run the following query: SELECT MAX(CAST(IssueDate as Date)) FROM (SELECT IssueDate FROM [Transient].[Commissions_TIB] WHERE ISDATE(issuedate) = 1 …

Count distinct per fiscal year and display all dates in query result

DB-Fiddle: CREATE TABLE customers ( id int auto_increment primary key, order_date DATE, customerID VARCHAR(255) ); INSERT INTO customers (order_date, customerID ) VALUES (“2020-01-…

SQL count distinct # of calls 6 months prior to create date

Am trying to figure out the SQL to: count # of distinct calls made on an account 6 months prior to the account being created I also need to CAST the date field. I’m thinking something like: case …

MySql Trigger Function about status

I would like to ask a solution for mysql database. since i made database(order) about 3 column named as order_date(datatype – date),expired_date(datatype – date) and status(varchar(10)). as status …

Postgres converting double double precision to text creates ‘1.50000000000’

Working with postgres and I need to convert total minutes into the format of 1h 1m. I’m doing this via the following code replace( (119 / 60 + (119 % 60) / 100.0)::text, ‘.’, ‘h ‘ ) + …

Oracle birthday column regex constrain violated

I want all my dates in my database in the following yyyy-mm-dd date format. For example, ‘2020-05-28’. But this doesn’t seem to work as I thought it would when I insert a date into my User table which …

query for trunc(date) on a view that already filters for date

We’re accessing a view from another team’s database and to make it a lot simpler, the view looks a bit like this: create view x_view as select x.exec_time, … from stuff x where x.exec_time &…

Fill in missing dates and grouping problem

I have a table with Case records with CaseId, UserId, Opened date, Closed date etc value. For reporting I need to have a result table with all users by continuous months with number of case still …