Last updated 10 July 2017. Created on 18 December 2005.
Edited by tebrooks63, Shai, sepeck, Uwe Hermann. Log in to edit this page.

Just as PHP snippets provide a quick and sometimes elegant solution to common presentation, display, or interaction requirements, SQL snippets are shortcuts to providing specific configurations, and otherwise performing operations on the database which can't be achieved easily through the web interface or API.

Got a handy SQL script that you use as a configuration shortcut? A script to help move databases from one Drupal installation to another? How about a favorite SQL or database related tip or trick? Share it here!

Submission notes: Please indicate at the top of your page which database engine and version (e.g., MySQL 4.5), and which Drupal version (e.g., Drupal 4.6.5) your script applies to. Please use the coding standards for Drupal.

PLEASE NOTE! The following snippets are user submitted. Use at your own risk!

NEVER just copy and paste a snippet without looking at what it does and/or creating a backup of your site, a user could potentially add a snippet that wipes your complete database!

Looking for support? Visit the forums, or join #drupal-support in IRC.