Questions tagged [operator]
41 questions
91
votes
4 answers
Authoritative source that <> and != are identical in performance in SQL Server
Consider this answer on SO that reassures the asker about the <> operator that:
<> is ... the same as !=.
But then a commenter pipes up and says:
It's true that they are, functionally, the same. However, how the SQL optimizer uses them is very…
![](../../users/profiles/6236.webp)
ErikE
- 4,235
- 4
- 27
- 39
27
votes
1 answer
Querying JSONB in PostgreSQL
I have a table, persons, which contains two columns, an id and a JSONB-based data column (this table has just been made for demonstrational purposes to play around with PostgreSQL's JSON support).
Now, supposed it contains two records:
1, { name:…
![](../../users/profiles/86358.webp)
Golo Roden
- 402
- 1
- 4
- 9
19
votes
5 answers
Select multiple values in LIKE Operator
I have a SQL query given below, I want to select multiple value using like operator.
Is my Query correct?
SELECT top 1 employee_id, employee_ident, utc_dt, rx_dt
FROM employee
INNER JOIN employee_mdata_history
ON …
![](../../users/profiles/117459.webp)
l.lijith
- 868
- 4
- 9
- 24
18
votes
3 answers
EXCEPT operator vs NOT IN
The EXCEPT operator was introduced in SQL Server 2005 but what is the difference between NOT IN and EXCEPT ?
Does it do the same? I would like a simple explanation with an example.
![](../../users/profiles/48130.webp)
Heisenberg
- 1,447
- 5
- 18
- 31
13
votes
1 answer
What does the Postgres <-> operator do?
I was reading through the Postgres documentation on materialized views and in one example they use the following:
SELECT word FROM words ORDER BY word <-> 'caterpiler' LIMIT 10;
I tried to run a similar query on my own database, but I get an…
![](../../users/profiles/55483.webp)
Villiers Strauss
- 577
- 1
- 5
- 9
10
votes
2 answers
PostgreSQL custom operator UUID to varchar
I have a rather complicated Postgres database in which many UUID fields were incorrect stored as VARCHAR. I'd like to migrate them over in piecemeal, but unfortunately, doing so breaks all my views as Postgres doesn't have a built in operator for…
![](../../users/profiles/31329.webp)
keithhackbarth
- 225
- 1
- 2
- 7
10
votes
1 answer
What is BMK Operator in SQLServer
I was trying to answer this question stating from clause is optional..But i am stuck with an Operator in plan..below is screenshot of execution plan ..
As you can see there is BMK operator in query plan ,but no indication showing how it is…
![](../../users/profiles/31995.webp)
TheGameiswar
- 2,919
- 4
- 26
- 48
7
votes
1 answer
PostgreSQL operator uses index but underlying function does not
I'm attempting to use JSONB with JDBC, which means that I have to avoid any of the operators which use the '?' character (as the PostgreSQL JDBC driver has no escaping for this character). Taking a simple table:
CREATE TABLE jsonthings(d JSONB NOT…
![](../../users/profiles/26587.webp)
jgm
- 305
- 1
- 3
- 10
7
votes
2 answers
'+' operator with one operand!
How does '+' operator behave in following statement?
select + 'taco'; --Result is 'taco'
Is it doing string concatenation with first string blank ('' + 'taco'), or does it mean something else?
![](../../users/profiles/28434.webp)
user353gre3
- 1,451
- 1
- 13
- 20
6
votes
1 answer
PostgreSQL custom operator for equality
I want to build a custom equality operator in PostgreSQL, which can be used in GROUP BY, UNION and DISTINCT [ON] for the json type (just for the sake of curiosity, not for real-world implementation -- that's why the upcoming jsonb type is not what…
![](../../users/profiles/40889.webp)
pozs
- 386
- 1
- 9
6
votes
2 answers
PostgreSQL - CAST vs :: operator on LATERAL table function
While I can
SELECT elem[1], elem[2]
FROM ( VALUES ('1,2'::TEXT) ) AS q(arr),
LATERAL CAST(String_To_Array(q.arr, ',') AS INT[]) AS elem
;
using an explicit call to CAST, I can't
SELECT elem[1], elem[2]
FROM ( VALUES ('1,2'::TEXT) ) AS…
![](../../users/profiles/169959.webp)
geozelot
- 183
- 1
- 10
6
votes
1 answer
What does the vertical pipe slash operator do?
I'm wondering what pipe slash |/ does in,
SET equal_area_radius = |/area/pi();
The statement works and it definitely changes the value:
SELECT |/125.555/pi(); -- returns: 6.32181918120139
SELECT 125.555/pi(); -- returns: 39.9653977598058
What…
![](../../users/profiles/601.webp)
Jay Cummins
- 605
- 3
- 9
- 17
6
votes
1 answer
How does the operator "&" work in sql server?
I was running a trace on one of our test servers when someone did this:
and one of the queries I could catch in the trace was:
declare @UserOption int
select @UserOption=convert(int, c.value) from sys.configurations c where c.name='user…
![](../../users/profiles/22336.webp)
Marcello Miorelli
- 15,417
- 50
- 140
- 271
5
votes
1 answer
what does !! as an operator in mysql?
I tried to use the exclamation mark as a not operator in a query
SELECT !0, !!0, !!!0, !1, !!1, !!!1, !2, !!2, !!!2;
| !0 | !!0 | !!!0 | !1 | !!1 | !!!1 | !2 | !!2 | !!!2 |
|----|-----|------|----|-----|------|----|-----|------|
| 1 | 1 | 0 …
![](../../users/profiles/8753.webp)
Mathieu
- 165
- 1
- 7
5
votes
1 answer
Use square brackets on extended events filter
I want create an extended events session and use the like_i_sql_unicode_string operator to filter the phrase [demo], with the square brackets.
I've started with:
CREATE EVENT SESSION [demo] ON SERVER
ADD EVENT sqlserver.sql_batch_completed(
…
![](../../users/profiles/241120.webp)
Jorge Bugal
- 218
- 1
- 4