Condition (SQL): Difference between revisions

Content deleted Content added
Yobot (talk | contribs)
m WP:CHECKWIKI error fixes using AWB (9075)
Examples: syntax highlight
Line 37:
==Examples==
To '''<tt>SELECT</tt>''' one row of data from a table called ''tab'' with a primary key column (''pk'') set to 100 &mdash; use the condition ''pk = 100'':
<source lang="sql">SELECT * FROM tab WHERE ''pk = 100''</source>
 
SELECT * FROM tab WHERE ''pk = 100''
 
To identify whether a table ''tab'' has rows of data with a duplicated key column ''dk'' set to 100 &mdash; use the condition ''dk = 100'' and the condition ''having count(*) > 1'':
<source lang="sql">SELECT * FROM tab WHERE ''dk = 100'' havingHAVING count(*) > 1</source>
 
SELECT * FROM tab WHERE ''dk = 100'' having count(*) > 1
 
{{SQL}}