SQL Best Practices: Revision history

Jump to navigation Jump to search

Diff selection: Mark the radio buttons of the revisions to compare and hit enter or the button at the bottom.
Legend: (cur) = difference with latest revision, (prev) = difference with preceding revision, m = minor edit.

7 January 2022

  • curprev 11:2811:28, 7 January 2022Video8 talk contribs 441 bytes +441 Created page with "== Determining if a record exists == <syntaxhighlight lang="sql"> SELECT EXISTS (SELECT 1 FROM users_table WHERE user_table.userid = p_userId) INTO p_isPresent; </syntaxhighlight> Not <syntaxhighlight lang="sql"> SELECT COUNT(*) FROM users_table WHERE user_table.userid = p_userId INTO p_isPresent; </syntaxhighlight> `SELECT EXISTS` stops as soon as it finds a match. `COUNT` counts all matches. Category:MySQLCategory:MariaDB"