Welcome To Snipplr
Everyone's Recent SQL Snippets
- All /
- JavaScript /
- HTML /
- PHP /
- CSS /
- Ruby /
- Objective C
Minimal syntax for cursor use. See URL for SQL 2005 options and improvements.
0
545
posted 13 years ago by rengber
This is by no means the most efficient way to do this, in terms of performance.
It is however the easiest way.
1
448
posted 14 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
424
posted 14 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
459
posted 14 years ago by mynameisharry
Just replace TABLENAME.OLD_COLUMNNAME and NEW_COLUMNNAME with your new values.
0
454
posted 14 years ago by naspinski
When you make a login remember to use CASE SENSITIVE on password and case insensitive on username
0
555
posted 14 years ago by ginoplusio
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
638
posted 14 years ago by RICHARDP
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
431
posted 14 years ago by stavelin
Creates a MySQL table with all 50 states + Washington D.C. in alphabetical order.
1
403
posted 14 years ago by simplistik
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
380
posted 14 years ago by DaveChild
Where bad_table is the name of the table containing duplicate rows.
2
331
posted 14 years ago by jdbartlett
This Oracle SQL snippet converts an Oracle SQL DATE to a STRING in the form CCYYMMDD.
0
956
posted 14 years ago by retry