DTD: Like appears to miss escape clause, and table-less selects.



Regarding the "like" operator.
==============================
There *can* be three arguments.
The classic two you are all thinking about, and
the escape operator.
The escape operator allows wildcards to be sometimes
taken literally.
Assuming _ is a single character wildcard
Assuming % is a multi-character wildcard

select * from table where column like '%\_%' escape '\';

The above returns rows where the column contains an underscore.

select * from table where column like '%_%';

The above returns ALL rows.

I've seen this in a couple of engines.


Tableless selects
=================
Sybase permits the selection of expressions without
mentioning a table

"select 1+1" is a valid complete Sybase SQL statement
and displays (funnily enough) the value "2".

Oracle has a one-row one-column view for this, the
weirdly named "DUAL" table.

Used when you want something from the database such
as the system time AT THE BACKEND, version numbers,
a return from a stored function, etc.
-- 
David T. Bath bathd@edipost.auspost.com.au
+613 9204 8713 (W) 0418 316 634 (Mbl)




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]