Community Documentation

SQL snippets

Last updated June 5, 2008. Created by Shai on December 18, 2005.
Edited by sepeck, Uwe Hermann, puregin. 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!

About this page

Drupal version
Drupal 4.7.x, Drupal 5.x, Drupal 6.x

Reference

Drupal’s online documentation is © 2000-2013 by the individual contributors and can be used in accordance with the Creative Commons License, Attribution-ShareAlike 2.0. PHP code is distributed under the GNU General Public License. Comments on documentation pages are used to improve content and then deleted.