Categories:
.NET (357)
C (330)
C++ (183)
CSS (84)
DBA (2)
General (7)
HTML (4)
Java (574)
JavaScript (106)
JSP (66)
Oracle (114)
Perl (46)
Perl (1)
PHP (1)
PL/SQL (1)
RSS (51)
Software QA (13)
SQL Server (1)
Windows (1)
XHTML (173)
Other Resources:
How To Use Subqueries with the EXISTS Operator
How To Use Subqueries with the EXISTS Operator? - MySQL FAQs - SQL SELECT Statements with JOIN and Subqueries
✍: FYIcenter.com
A subquery can be used with the EXISTS operator as "EXISTS (subquery)", which returns true if the subquery returns one or more rows. The following statement is a good example of "EXISTS (subquery)". It returns rows from fyi_links table that there are rows existing in the fyi_rates table with the same id.
mysql> SELECT id, url, tag, YEAR(created) As year FROM fyi_links WHERE EXISTS ( SELECT * FROM fyi_rates WHERE fyi_rates.id = fyi_links.id); +-----+-------------------+------+------+ | id | url | tag | year | +-----+-------------------+------+------+ | 101 | dev.fyicenter.com | DEV | 2006 | | 102 | dba.fyicenter.com | DBA | 2006 | | 103 | sqa.fyicenter.com | SQA | 2006 | +-----+-------------------+------+------+ 3 rows in set (0.00 sec)
2007-05-11, 5624👍, 0💬
Popular Posts:
WHat will be the result of the following code? #define TRUE 0 // some code while (TRUE) { // some co...
How To Check the Oracle TNS Settings? - Oracle DBA FAQ - ODBC Drivers, DSN Configuration and ASP Con...
Why does malloc(0) return valid memory address? What's the use? malloc(0) does not return a non-NULL...
What is page thrashing? Some operating systems (such as UNIX or Windows in enhanced mode) use virtua...
What is page thrashing? Some operating systems (such as UNIX or Windows in enhanced mode) use virtua...