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, 5884👍, 0💬
Popular Posts:
Can you have virtual functions in Java? Yes, all functions in Java are virtual by default. This is a...
Can one execute dynamic SQL from Forms? Yes, use the FORMS_DDL built-in or call the DBMS_SQL databas...
If cookies are not enabled at browser end does form Authentication work? No, it does not work.
Can event’s have access modifiers ? Event’s are always public as they are meant to serve every one r...
What is the output of printf("%d")? 1. When we write printf("%d",x); this means compiler will print ...