In SQL Server, you can use the T-SQL INTERSECT
operator to return distinct rows that are output by both the left and right input queries.
Tag: what is
How to Test for Overlapping Dates in PostgreSQL
In PostgreSQL, you can use the OVERLAPS
operator to test for overlapping time periods.
The function returns true when two time periods (defined by their endpoints) overlap, and false when they do not overlap.
Continue readingHow IIF() Works in SQL Server
In SQL Server, the IIF()
function (not to be confused with the IF
statement) is a conditional function that returns the second or third argument based on the evaluation of the first argument.
It’s a shorthand way for writing a CASE
expression. It’s logically equivalent to CASE WHEN X THEN Y ELSE Z END
assuming IIF(X, Y, Z)
.
IIF()
is an abbreviation for Immediate IF.
How the IF Statement Works in SQL Server
Most (probably all) programming languages include some form of the IF
statement that allows programmers to write conditional code. That is, code that will execute only if a certain condition is true.
It’s a very simple concept. Basically it goes like this:
“If this, do that.”
Most languages simply call it IF
, but some have their own twist on the name (for example, in ColdFusion/CFML, it’s called CFIF
).
In any case, they essentially do the same thing.
In SQL Server (or more precisely, its programming language T-SQL) it’s called IF
.
How AT TIME ZONE Works in PostgreSQL
In PostgreSQL, you can use the AT TIME ZONE
clause to convert a timestamp to another timezone.
How make_interval() Works in PostgreSQL
In PostgreSQL, the make_interval()
function creates an interval from years, months, weeks, days, hours, minutes and seconds fields.
You provide the years, months, weeks, days, hours, minutes and/or seconds fields, and it will return an interval in the interval data type.
Continue readingHow make_timestamptz() Works in PostgreSQL
In PostgreSQL, the make_timestamptz()
function allows you to create a timestamp with time zone from its year, month, day, hour, minute and seconds fields, as well as an optional timezone field.
How make_date() Works in PostgreSQL
In PostgreSQL, the make_date()
function allows you to create a date from its separate year, month and day fields.
Each date part is provided as an integer, and the result is returned as a date.
Continue readingHow make_time() Works in PostgreSQL
In PostgreSQL, the make_time()
function allows you to create a time from its hour, minute and seconds fields.
How make_timestamp() Works in PostgreSQL
In PostgreSQL, the make_timestamp()
function allows you to create a timestamp from its year, month, day, hour, minute and seconds fields.