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, 5507👍, 0💬
Popular Posts:
How To Test Transaction Isolation Levels? - MySQL FAQs - Transaction Management: Commit or Rollback ...
If locking is not implemented what issues can occur? IFollowing are the problems that occur if you d...
Can you explain in GSC and VAF in function points? In GSC (General System Characteristic) there are ...
What is the difference between Authentication and authorization? This can be a tricky question. Thes...
How To Join a List of Keys with a List of Values into an Array? - PHP Script Tips - PHP Built-in Fun...