Questions tagged [ansi-sql]
ANSI SQL is the American National Standards Institute adopted Structured Query Language standard, developed by ISO/IEC JTC 1. It is the base for the different SQL dialects used by different DBMS vendors.
ansi-sql
363
questions
1
vote
2
answers
44
views
SQL Different conditions based on where clause
I am interested in if there is an easier way to perform the following query than looping over unions.
What I want to do is have separate where clauses based on different filtering fields. Say I have ...
0
votes
3
answers
57
views
Query outer join fixed values
I would like to query some IDs (fixed values) into a table, like a "outer join" with the mandatory fields should be the fixed values. I have to do the same for SQL Server and MySQL, but with ...
1
vote
1
answer
37
views
rewrite old sql but result of two sql is not the same
I want to rewrite old sql
select * from a, b, c where a.columnA = b.columnB and a.columnC *= c.columnD and a.columnE *= c.columnF
I tried as below
select * from a join b on a.columnA = b.columnB left ...
0
votes
2
answers
102
views
Is there a way to write joining where clauses without AND operator?
Just for curiosity, is there a short/pretty way to write classic SQL where clauses without the AND operator for joining tables?
Classic:
select *
from table1, table2, table3
where table1.fkId = ...
0
votes
2
answers
55
views
How can I join data to my table that isn't available for everyone without losing results?
I have a main table, Table 1, that includes columns for student ID and some other info. There is also Table 2 which includes columns for student ID, survey question, and response.
Essentially, I want ...
0
votes
1
answer
143
views
Converting VARCHAR to floating decimal in SQL?
I’m trying to convert a “string” column into all float values and can’t seem to get the correct output. The STRING values are all in #.## format (eg. 2.33, 4.25, 3.75, etc.) I have a query that looks ...
0
votes
1
answer
118
views
Databricks change data feed
According to documentation change data feed on Databricks
support both batch queries and streaming queries.
I was wondering if there is anyway to pass the parameters inside the batch queries.
More ...
0
votes
1
answer
307
views
Dremio SQL injection vulnerability
I'd like to query an S3 storage containing parquet files through my Spring Java app with Dremio. These are dynamic queries with user given parameters.
I use Apache Arrow SQl driver and simply run ...
1
vote
4
answers
98
views
Is there a way to delete / update duplicate values in a time sequence?
I have a table that looks like (never mind the database vendor as I need this in ANSI SQL):
create table edge (
parent_id int not null,
child_id int not null,
value float not null,
start ...
1
vote
0
answers
46
views
Is every data type in ANSI SQL sortable?
Can I use an ORDER BY clause with any SQL data type?
For example, will the query
SELECT Column1
FROM TableName
ORDER BY Column1
return results, no matter the data type of Column1, grouping columns ...
0
votes
1
answer
58
views
Comparing various date/time types
Is it defined how a date should be compared to a timestamp with a timezone or a timestamp without a timezone? For example, something like:
SELECT
DATE '2014-01-01' = TIMESTAMP WITH TIME ZONE '2014-...
2
votes
2
answers
237
views
Why is NULL handled differently in aggregate and scalar functions?
Let's take the following two queries:
select greatest(1, val) from unnest([null]) as val
# null
And:
select sum(val) from unnest([1, null]) as val
# 1
My question is why is null handled differently ...
3
votes
1
answer
404
views
SQL Lag on CURRENT_ROW Window Frame
Consider the following SQL window query:
SELECT LAG(no) OVER (ROWS BETWEEN CURRENT ROW AND CURRENT ROW) FROM account;
I'd like to understand what the behaviour should be according to ANSI standard ...
0
votes
3
answers
126
views
Insert result of a parametrized query into a CTE
I am querying a table containing billions of rows (BIG_TABLE) in Oracle. The table is partitionned on a monthly basis (DTE is the month of flux). The DBA wants us to filter our queries by month of ...
0
votes
0
answers
119
views
ANSI SQL: Ordering results by picking some certain values of the columns
I'm catching up on ANSI SQL, and got stuck with a theoretically easy question that I can't figure out myself. I hope someone can give me a hand.
How can i do to order results of a query by some ...