Welcome To Snipplr


Everyone's Recent SQL Snippets



This is by no means the most efficient way to do this, in terms of performance. It is however the easiest way.
1 1307 posted 16 years ago by xtheonex
I was having the hardest time getting this to work. It's a collection of various items. For whatever reason, I needed to include the CASE statement due to NULL's coming back. If this helps you out... go for it.
0 1161 posted 16 years ago by gembry
Create a random password using a Dictionary database table. Selects a random word, and then appends two random numbers to the end, creating passwords in the form of: foozling98 or laicism11
1 1197 posted 16 years ago by mynameisharry
0 825 posted 16 years ago by manec
Just replace TABLENAME.OLD_COLUMNNAME and NEW_COLUMNNAME with your new values.
0 1157 posted 16 years ago by naspinski
get some random record from mysql quickly。
0 1334 posted 16 years ago by liuran
0 1280 posted 16 years ago by jachin
0 1367 posted 16 years ago by ginoplusio
0 1051 posted 16 years ago by ginoplusio
1 1317 posted 16 years ago by ginoplusio
When you make a login remember to use CASE SENSITIVE on password and case insensitive on username
0 1379 posted 16 years ago by ginoplusio
1 878 posted 16 years ago by ericserrat
0 1663 posted 16 years ago by Wardy
Fields are tab delimited and need to match table schema. I've found the tab separator ASCII(009) preferable over using a comma. The second version can help remove double quotation marks around character fields. Don't forget the keyword LOC...
0 1581 posted 16 years ago by RICHARDP
0 1246 posted 17 years ago by therobot
0 1102 posted 17 years ago by hdanniel
It's easy to find the categories used on one item, but find all categories NOT used on current item? This snippet stores a "NOT IN" query. This is used with PHP & mySQL. The query can be written differently on other databases, but this seems to w...
0 1201 posted 17 years ago by stavelin
Creates a MySQL table with all 50 states + Washington D.C. in alphabetical order.
1 1108 posted 17 years ago by simplistik
0 1173 posted 17 years ago by DaveChild
This script should be run from the "master" database. It will destroy the dev copy of a database and restore from the live copy. Code slightly modified from original (linked).
0 1122 posted 17 years ago by DaveChild
Where bad_table is the name of the table containing duplicate rows.
2 996 posted 17 years ago by jdbartlett
This Oracle SQL snippet converts an Oracle SQL DATE to a STRING in the form CCYYMMDD.
0 2219 posted 17 years ago by retry
This is useful if you are changing a Drupal site's file upload path and/or changing from a private to a public file store.
3 2419 posted 17 years ago by shrop
Imports data from CSV (excel-compatible format) into MySQL. Also check the mysqlimport utility and the complementary SELECT ... INTO OUTFILE.
4 1850 posted 17 years ago by jarnaldich
This will create and then populate a MySQL table with a list of the names and USPS abbreviations for US states and possessions in existence.
3 3841 posted 17 years ago by cbrant