All Questions
136
questions
1
vote
2
answers
61
views
The "-" Operator in SQL where condition
I am encountering a rather peculiar syntax in MySQL, specifically the presence of a '-' symbol within the WHERE condition in the following query.
SELECT
users.id
FROM
users
WHERE
users....
0
votes
0
answers
40
views
SQL without using union or union all
I am trying to write a sql query to get table name and counts of multiple tables under same result columns.
Final Table:
table_name table_count
tbl1 10
tbl2 20
tbl3 40.....
-1
votes
1
answer
284
views
Why do I keep getting a syntax error in BigQuery
I can't seem to identify what I'm doing wrong. This is the error I'm getting
No matching signature for operator = for argument types: STRING,
INT64. Supported signature: ANY = ANY at [15:8]
enter ...
1
vote
1
answer
57
views
why "Between" operator not working with month text in mysql?
In my dataset, months are stored in a format as 'June-21', 'Aug-21' like that.
For a query with Between:
Select sum(downloads)
from ratings
where months between 'October-21'and 'December-21';
It ...
-3
votes
1
answer
512
views
Can I use "/" operator on nvarchar column type in SQL Server Management Studio? [closed]
I am trying to divide 2 columns which are defined as nvarchar, but SSMS throws an error saying you can not use / operator on nvarchar.
select
location, date, total_cases, total_deaths,
(...
0
votes
2
answers
52
views
Dates Datatype Operation
Why does this SQL statement work:
SELECT SYSDATE - 1 - DATE '2019-01-01' FROM DUAL
and this one does not work?
SELECT 1 - SYSDATE - DATE '2019-01-01' FROM DUAL
I understand that you cannot operate a ...
0
votes
1
answer
52
views
MySQL: Is there an operator to identify unique values?
I want to update the column 'status' in a dataframe 'Enrollments' that references another 'visitID' column, but I want the values within 'status' to be as follows:
When there are 2 or more Id's that ...
1
vote
1
answer
93
views
Rewriting simple query using EXISTS, IN, ALL, ANY operators
I have the following tables:
Ships (Name is PK)
Name
Class
Launching_year
Kongo
Kongo
1912
Haruna
Kongo
1913
Evstafi
Evstafi
1906
Consequences ((Ship, Battle) is UK, ship is FK to Ships table)
...
1
vote
2
answers
419
views
More efficient way to concatenate long strings(varchar(max)) than "CONCAT" or "+"
We are developing a software product that needs a very big amount of data and we are trying to find the most efficient way to concatenate 3 strings. We used the most known ways to concatenate the ...
0
votes
1
answer
59
views
Validate combination of codes with clause operators
First of all, I'm sorry this question may sound easy, but I'm not a real programmer, just a hobbyist.
I have a problem I can't get around solving how to program following thing in any available ...
0
votes
1
answer
143
views
Arity of BETWEEN expression
What is the arity of the sql BETWEEN expression? I thought it was three (ternary) since the expression usually looks like:
WHERE...
1 BETWEEN 2 AND 3
But it's listed as binary on BigQuery's ...
-1
votes
1
answer
62
views
How to do operators in multiple select statements? MySQL
The goal is Forested land / (forested + non-forested land area)
here is what I have tried, but shows errors such as
operand should contain 1 column(s)
below I just tried to add up first. Need your ...
1
vote
1
answer
67
views
MySQL hyphen/minus character in place of equals in where clause gives unexpected result
When typing an SQL query for use with MySQL I accidentally mistyped a hyphen/minus sign (-) in place of an equals sign (=). This resulted in the query being:
select id, field from table where id - 9;
...
-1
votes
2
answers
1k
views
PostgreSQL SQL output by slice data using logic operator
I need to upload from PostgreSQL data from invoice, 'billing_address' and 'billing_city', and it must be between 2009-09-01 to 2009-09-30 (sept.2009) in 'invoice_date'.
In result must be 2 columns ...
1
vote
1
answer
558
views
SQL date filter operator
Just a general date filter question, what are the valid operators for me to filter a specific timeframe as I had this error:
Cannot apply operator: date <= varchar(8)
code:
where utc_date >= '...