ansi-sql Questions
1
This is a bit of a philosophical question, I guess...
Say I execute this query in SQL Server:
SELECT mygroup, COUNT(mycolumn)
FROM mytable
GROUP BY mygroup
The counted column contains NULLs and th...
Machinist asked 4/7, 2013 at 10:43
5
Solved
I have a table tb_FirstName with one field FirstName. The table has 100 million non null records with lots of repetitions e.g. John occurs 2 million times. The distinct count of FirstName is over 2...
Fasto asked 29/3, 2013 at 11:29
4
Solved
I have the following medleys table that combines colors, fruits and ratings:
[medleys]
medley_id | color | fruit | rating
==============================================
1 red apple 25
2 blue pear ...
6
Solved
Surprise -- this is a perfectly valid query in MySQL:
select X, Y from someTable group by X
If you tried this query in Oracle or SQL Server, you’d get the natural error message:
Column 'Y' is i...
Rochellerochemont asked 3/8, 2009 at 23:44
2
Solved
recently, while working on a db2 -> oracle migration project, we came across this situation.
the developers were inadvertently creating new table structures using decimal(s,p) columns. I didn't rem...
Tweezers asked 14/6, 2012 at 10:42
2
Solved
I've looked at a number of similar questions, but have yet to stumble upon/find the correct solution to the problem below.
Given the following three tables:
account
profile_id number (nullable)
...
Kemeny asked 8/9, 2012 at 15:43
1
Solved
I am using an ORM (sqlalchemy) to fetch data from a PG database. I want to avoid specifying all the table column names in my hand crafted SQL statements*.
My assumption so far is that the returned...
Poinsettia asked 31/7, 2012 at 9:40
1
Solved
So we are migrating from Informix to Sql Server. And I have noticed that in Informix the queries are written in this manner:
select [col1],[col2],[col3],[col4],[col5]
from tableA, tableB
where tab...
Revue asked 28/6, 2012 at 19:41
12
Solved
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 compon...
Woden asked 24/4, 2009 at 8:3
5
I've been searching for half an hour and can't find any resources stating what level of the SQL ANSI standard is supported on various database engines.
It looks like some level of support is provi...
2
Solved
On the Wikipedia page for SQL there are some truth tables about boolean logic in SQL. [1] The Wikipedia page seems to source the SQL:2003 standard.
The truth table for the equals operator (=) is d...
Misjoinder asked 22/3, 2012 at 12:20
2
Solved
I'm wondering if there is a list of supported Select Count SQL statements per the ANSI standard? The below three variations are what I know of. Can the where clause be used on all three below?
SEL...
2
Solved
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 wheth...
Olympian asked 30/12, 2008 at 10:48
2
Solved
ANSI-92 SQL mandates that comparisons with NULL evaluate to "falsy," eg:
SELECT * FROM table WHERE field = NULL
SELECT * FROM table WHERE field != NULL
Will both return no rows because NULL can'...
2
Solved
I know there is really no difference, but is 'LEFT JOIN' an ANSI form or are there any RDBMS's that will fail 'LEFT JOIN' and require 'LEFT OUTER JOIN'. [I am asking here so I can save a few clicks...
Stomatal asked 8/7, 2011 at 14:30
3
Solved
I would like to confirm that the SQL query
SELECT ....
FROM apples,
oranges
LEFT JOIN kiwis ON kiwis.orange_id = oranges.id,
bananas
WHERE ....
is exactly equivalent to other permutations i...
Maugham asked 15/2, 2011 at 21:14
5
Solved
In MS Sql Server is easy create autoincrement fields. In my systems I stopped to use autoincrement fields for primary keys, and now I use Guid's. It was awesome, I've got a lot of advantages with t...
Pitchstone asked 8/2, 2009 at 21:36
9
Solved
We are developing ETL jobs and our consultant has been using "old style" SQL when joining tables
select a.attr1, b.attr1
from table1 a, table2 b
where a.attr2 = b.attr2
instead of using the inne...
Candlepower asked 10/9, 2010 at 11:33
2
Solved
Is this valid ANSI SQL?:
SELECT 1 AS X
,2 * X AS Y
,3 * Y AS Z
Because Teradata (12) can do this, as well as this (yes, crazy isn't it):
SELECT 3 * Y AS Z
,2 * X AS Y
,1 AS X
But SQL Serv...
Ovarian asked 16/3, 2010 at 22:45
8
Solved
Can any of these queries be done in SQL?
SELECT dates FROM system
WHERE dates > 'January 5, 2010' AND dates < 'January 30, 2010'
SELECT number FROM system
WHERE number > 10 AND number ...
5
Solved
My team is looking into geospatial features offered by different database platforms.
Are all of the implementations database specific, or is there a ANSI SQL standard, or similar type of standard,...
Hag asked 16/3, 2009 at 19:46
5
Solved
I am attempting to make an application capable of running on both Sql Server and PostgreSQL.
I can not seem to find a common expression that is basically
select * from table where booleancol=fa...
Antebi asked 22/12, 2009 at 20:12
4
Solved
I need a way to determine the number of days between two dates in SQL.
Answer must be in ANSI SQL.
Yonyona asked 25/11, 2009 at 22:11
2
Solved
I'm trying to convert some Oracle SQL queries to work with (in theory) any SQL database. Some of the queries are hierarchical in nature and are written using CONNECT BY.
Is there a standard SQL al...
1
Solved
Is it allowed to cast types in ANSI SQL like in postgres for example:
SELECT SUM( CAST(qnty AS int) - CAST(reserve AS int) ) AS sum
...
qnty and reserve are character columns.
© 2022 - 2024 — McMap. All rights reserved.