Categories:
.NET (961)
C (387)
C++ (185)
CSS (84)
DBA (8)
General (31)
HTML (48)
Java (641)
JavaScript (220)
JSP (109)
JUnit (31)
MySQL (297)
Networking (10)
Oracle (562)
Perl (48)
Perl (9)
PHP (259)
PL/SQL (140)
RSS (51)
Software QA (28)
SQL Server (5)
Struts (20)
Unix (2)
Windows (3)
XHTML (199)
XML (59)
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, 5451👍, 0💬
Popular Posts:
How To Manage Transaction Isolation Level? - Oracle DBA FAQ - Introduction to PL/SQL Transaction iso...
Give me the example of SRS and FRS SRS :- Software Requirement Specification BRS :- Basic Requiremen...
Regarding C Coding Given: Line in file Contents 30 int * someIDs, theFirst, *r; 110 someIDs =GetSome...
How To Change System Global Area (SGA)? - Oracle DBA FAQ - Introduction to Oracle Database 10g Expre...
How To Set session.gc_divisor Properly? - PHP Script Tips - Understanding and Using Sessions As you ...