ansi-sql

Netezza UPDATE from one table to another

女生的网名这么多〃 提交于 2019-12-03 15:50:21
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? Please help. Donal UPDATE TABLE1 A SET A.COL1 = B.COL1 FROM TABLE2 B WHERE A.ID = B.ID AND A.DeptID = 3 AND B.DeptID = 104; 来源: https://stackoverflow.com/questions/25165835/netezza-update-from-one-table-to-another

Why does no database fully support ANSI or ISO SQL standards?

别来无恙 提交于 2019-12-03 06:28:33
问题 If I were designing a oil refinery, I wouldn't expect that materials from different vendors would not comply with published standards in subtle yet important ways. Pipework, valves and other components from one supplier would come with flanges and wall thicknesses to ANSI standards, as would the same parts from any other supplier. Interoperability and system safety is therefore assured. Why then are the common databases so choosy about which parts of the standards they adhere to, and why have

Why does no database fully support ANSI or ISO SQL standards?

ぐ巨炮叔叔 提交于 2019-12-02 19:59:28
If I were designing a oil refinery, I wouldn't expect that materials from different vendors would not comply with published standards in subtle yet important ways. Pipework, valves and other components from one supplier would come with flanges and wall thicknesses to ANSI standards, as would the same parts from any other supplier. Interoperability and system safety is therefore assured. Why then are the common databases so choosy about which parts of the standards they adhere to, and why have no 100% standards-compliant systems come to the fore? Are the standards 'broken', lacking in scope or

Eliminate subquery for average numeric value

允我心安 提交于 2019-12-02 10:39:59
问题 Quest The query selects all the points beginning with "Vancouver" and are within a 5 minute area from the center of all locations beginning with "Vancouver". For example, Vancouver South Fraser, Vancouver Fairview, and Vancouver Ballantree Place W have latitudes and longitudes within 5 minutes of their average latitude and longitude. The latitudes and longitudes are stored as (4915, 12311) integer pairs (meaning 49.15'N and 123.11'W). SQL Code The following SQL abomination does the trick:

Eliminate subquery for average numeric value

送分小仙女□ 提交于 2019-12-02 05:56:12
Quest The query selects all the points beginning with "Vancouver" and are within a 5 minute area from the center of all locations beginning with "Vancouver". For example, Vancouver South Fraser, Vancouver Fairview, and Vancouver Ballantree Place W have latitudes and longitudes within 5 minutes of their average latitude and longitude. The latitudes and longitudes are stored as (4915, 12311) integer pairs (meaning 49.15'N and 123.11'W). SQL Code The following SQL abomination does the trick: SELECT NAME FROM STATION WHERE DISTRICT_ID = '110' AND NAME LIKE 'Vancouver%' AND LATITUDE BETWEEN (SELECT

Convert Oracle legacy outer join to Ansi SQL

为君一笑 提交于 2019-12-02 05:31:33
问题 I have a complex non ansi query and I need to convert in ansi query. so I will take a small example to describe my problem input query SELECT a.name, a.empno, b.loc, c.inr FROM a, b, c WHERE a.deptno = b.deptno(+) AND b.empno(+) = 190 a.deptno = c.deptno(+) AND c.empno(+) = 190; Thanks in advance 回答1: Your query is equivalent to the below ANSI compliant query: SELECT a.name, a.empno, b.loc, c.inr FROM tab a LEFT JOIN tab b ON a.deptno = b.deptno AND b.empno = 190 LEFT JOIN tab c ON a.deptno =

Is it possible to have an SQL query that uses AGG functions in this way?

馋奶兔 提交于 2019-12-02 01:32:08
问题 Assuming I have the following aggregate functions: AGG1 AGG2 AGG3 AGG4 Is it possible to write valid SQL (in a db agnostic way) like this: SELECT [COL1, COL2 ....], AGG1(param1), AGG2(param2) FROM [SOME TABLES] WHERE [SOME CRITERIA] HAVING AGG3(param2) >-1 and AGG4(param4) < 123 GROUP BY COL1, COL2, ... COLN ORDER BY COL1, COLN ASC LIMIT 10 Where COL1 ... COLN are columns in the tables being queried, and param1 ... paramX are parameters passed to the AGG funcs. Note: AGG1 and AGG2 are

Convert Oracle legacy outer join to Ansi SQL

大憨熊 提交于 2019-12-02 00:02:20
I have a complex non ansi query and I need to convert in ansi query. so I will take a small example to describe my problem input query SELECT a.name, a.empno, b.loc, c.inr FROM a, b, c WHERE a.deptno = b.deptno(+) AND b.empno(+) = 190 a.deptno = c.deptno(+) AND c.empno(+) = 190; Thanks in advance Your query is equivalent to the below ANSI compliant query: SELECT a.name, a.empno, b.loc, c.inr FROM tab a LEFT JOIN tab b ON a.deptno = b.deptno AND b.empno = 190 LEFT JOIN tab c ON a.deptno = c.deptno AND c.empno = 190; You have to place predicates b.empno = 190 and c.empno = 190 inside the ON

Is it possible to have an SQL query that uses AGG functions in this way?

痞子三分冷 提交于 2019-12-01 21:02:54
Assuming I have the following aggregate functions: AGG1 AGG2 AGG3 AGG4 Is it possible to write valid SQL (in a db agnostic way) like this: SELECT [COL1, COL2 ....], AGG1(param1), AGG2(param2) FROM [SOME TABLES] WHERE [SOME CRITERIA] HAVING AGG3(param2) >-1 and AGG4(param4) < 123 GROUP BY COL1, COL2, ... COLN ORDER BY COL1, COLN ASC LIMIT 10 Where COL1 ... COLN are columns in the tables being queried, and param1 ... paramX are parameters passed to the AGG funcs. Note: AGG1 and AGG2 are returned in the results as columns (but do not appear in the HAVING CLAUSE, and AGG3 and AGG4 appear in the

How to test SQL for validity from the command line?

我的未来我决定 提交于 2019-12-01 16:38:43
Is there a good tool for ensuring that an SQL query is valid ANSI SQL, and optionally what DBMSs will fail to interpret it? I've found http://developer.mimer.com/validator but I was wondering whether there is a command line tool, preferably open source. Here is a SQL Library that can help you to do vendor-specific offline SQL syntax check via command line, both Java and .NET demo were available. Maybe a parser/generator like ANTLR or JavaCC has an ANSI SQL 92 grammar already built. If so, you can run the parser/generator, build the classes that come out, and Bob's your uncle. I see that ANTLR