ansi-sql Questions

3

Solved

Is there an ANSI SQL compliant version of SQL SERVER's SELECT TOP n?
Ced asked 11/2, 2013 at 0:32

2

Solved

Small working example SELECT SPLIT("hello::hej::hallo::hoi", "::") returns an array [hello, hej, hallo, hoi] where I want to select the first element i.e. hello. BG Standard provides no FIRST, i...
Garay asked 7/4, 2018 at 19:16

10

Solved

How do you rewrite expressions containing the standard IS DISTINCT FROM and IS NOT DISTINCT FROM operators in the SQL implementation in Microsoft SQL Server 2008R2 that does not support them?
Epact asked 2/5, 2012 at 15:24

9

Solved

I know: Firebird: FIRST and SKIP; MySQL: LIMIT; SQL Server: ROW_NUMBER(); Does someone knows a SQL ANSI way to perform result paging?
Bead asked 21/1, 2009 at 1:42

3

Solved

Is the COALESCE a function of the ANSI SQL especification? Is it supported by the major relational databases?
Multicolor asked 25/7, 2018 at 15:26

3

Solved

I am interested in comparing, whether two tables contain the same data. I could do it like this: #standardSQL SELECT key1, key2 FROM ( SELECT table1.key1, table1.key2, table1.column1 - tabl...
Aschim asked 12/7, 2018 at 17:52

8

For example - I create database and a table from cli and insert some data: CREATE DATABASE testdb CHARACTER SET 'utf8' COLLATE 'utf8_general_ci'; USE testdb; CREATE TABLE test (id INT, str VARCHAR(...
Nidanidaros asked 21/7, 2011 at 19:58

3

Solved

I am wondering if there is a method to implement SQL analytic functions without using the inbuilt functions. SELECT *, ROW_NUMBER() OVER (PARTITION BY dept_id ORDER BY salary DESC) AS rownum, DE...
Chronicles asked 20/10, 2017 at 19:44

4

Solved

Is there an ANSI SQL equivalent to Oracle's DECODE function? Oracle's decode function is the IF-THEN-ELSE construct in SQL.
Electronic asked 9/7, 2010 at 11:15

6

What does || do in SQL? SELECT 'a' || ',' || 'b' AS letter
Grosberg asked 29/4, 2014 at 18:31

2

Solved

My coworker, who is new to ANSI join syntax, recently wrote a query like this: SELECT count(*) FROM table1 t1 JOIN table2 t2 ON (t1.col_a = t2.col_a) JOIN table3 t3 ON (t2.col_b = t3.col_b) ...
Percept asked 3/1, 2018 at 21:52

16

Solved

At every company I have worked at, I have found that people are still writing their SQL queries in the ANSI-89 standard: select a.id, b.id, b.address_1 from person a, address b where a.id = b.id ...
Fresnel asked 2/12, 2008 at 14:56

1

Solved

I have a simple table as bellow with lots of IDs and dates. ID Date 10R46 2014-11-23 10R46 2016-04-11 100R9 2016-12-21 10R91 2013-05-03 ... ... I want to formulate a query which counts the u...
Tressietressure asked 5/12, 2017 at 17:0

4

Solved

I am trying to migrate some legacy procedural code. I am having trouble figuring out the ANSI standard syntax to produce the same results. Below is one of the many combinations I have tried. What...
Fatling asked 29/8, 2012 at 21:7

3

Solved

I am trying to find the ANSI way to write the T-SQL 'IS NULL'. (corrected, was 'IN NULL') Some posts on the internet say you can use coalesce to make it work like 'IS NULL' The reason I like to do...
Thatch asked 9/2, 2013 at 19:52

2

Most SQL databases follow the ANSI SQL standards to a degree, but The standard is ambiguous, leaving some areas open to interpretation (eg: how different operations with NULLs should be handled i...
Ticking asked 21/9, 2011 at 6:39

3

Solved

I have a set of data that has been created by matching together similar sub-items, and then GROUPing these similar items by "category". Now, the resultant categories must be matched in such a way ...
Boisleduc asked 23/10, 2016 at 15:15

3

Solved

This has always bothered me - why does the GROUP BY clause in a SQL statement require that I include all non-aggregate columns? These columns should be included by default - a kind of "GROUP BY *" ...
Net asked 5/5, 2010 at 22:33

2

Solved

The question sounds confusing, but just look: This way we can get the first column (col1): select distinct maker from product And the second column (col2): select distinct type,maker from prod...
Bollix asked 26/3, 2015 at 11:6

2

I am new to SQL and have been searching for a way to set variables in ANSI SQL. I have this: select * from table1 where first_date > '2014-01-01' and where second_date = '2014-01-01' and where t...
Calcar asked 22/10, 2014 at 20:26

1

Solved

This is my query that does not work in Netezza: UPDATE TABLE1 A SET A.COL1= (SELECT DISTINCT B.COL1 FROM TABLE2 B WHERE B.ID= A.ID AND B.DeptID=104) WHERE A.DeptID=3 How do I re-write this query...
Greenroom asked 6/8, 2014 at 16:48

7

Solved

Is there an ANSI SQL alternative to the MYSQL LIMIT keyword? The LIMIT keyword limits the number of rows returned by a SELECT e.g: SELECT * FROM People WHERE Age > 18 LIMIT 2; returns 2 rows...
Gauzy asked 27/2, 2009 at 15:4

4

I am loking to implement a paging query in ANSI SQL. I tried the following query in SQL Server, but it did not allow it: select top 20 * from MyTable order by id except select top 10 * from MyTa...
Emarginate asked 1/5, 2014 at 15:28

2

Solved

I have the following table structures in a Postgres 9.1 database but the ideal solution should be DB agnostic if possible: Table: users |id|username| |1 |one | |2 |two | |3 |three | Table: items...
Bak asked 17/8, 2013 at 15:46

3

Solved

I'm using SQL (SQL Server, PostgreSQL) over 10 years and still I'm never used ANY/SOME and ALL keywords in my production code. All situation I've encountered I could get away with IN, MAX, MIN, EXI...
Magdamagdaia asked 11/7, 2013 at 8:1

© 2022 - 2024 — McMap. All rights reserved.