Hi, all
I'm writing Reference Manual and I have two questions:
1 - Why PostgreSQL accept HOUR, MINUTE and SECOND to extract if from a
date ?
EXTRACT (field FROM date_expression)
There are no such fields on a date!
It make sense only for SQL92 syntax because it uses also time and interval
types:
EXTRACT -- extract a datetime field from a datetime or interval.
The possible values for field are:
- YEAR
- MONTH
- DAY
- HOUR
- MINUTE
- SECOND
- TIMEZONE_HOUR
- TIMEZONE_MINUTE
------------------------------------------------------------------------
2. - Seems that optional ALL keyword of UNION doesn't work.
The following query prints always the same result with and without
the ALL clause.
* UNION of two tables:
mytable: yourtable:
id|name id|name
--+------ --+------
1|Smith 1|Soares
2|Jones 2|Panini
3|Soares
SELECT mytable.id, mytable.name
FROM mytable
WHERE mytable.name LIKE 'S%'
UNION
SELECT yourtable.id, yourtable.name
FROM yourtable
WHERE yourtable.name LIKE 'S%';
this is the result even if I don't specify ALL.
id|name
--+------
1|Smith
1|Soares
3|Soares
---------
SQL92 says that result does not contain any duplicate rows anless
the ALL keyword is specified.
What's wrong with my example ?
Thanks, Jose'