Welcome To Snipplr


Everyone's Recent MySQL Snippets



1 2 3 4 5 ... 8
How to find a given column in a given database in MySQL
1 133 posted 7 years ago by philsown
Create a new database and its respective user with all privileges
0 85 posted 7 years ago by claudiodev
How to remap a value to another inside a mysql query select.
0 159 posted 7 years ago by ginoplusio
You could start a transaction before running your queries and then rollback after running them. Note that to do this you'll require InnoDB or XtraDb tables (won't work on MyISAM).
0 160 posted 8 years ago by satie83
You have a schedule table (period, day, subject, room) with a primary key period,day to avoid duplicate bookings. You wish to display the schedule as periods, subjects and rooms in rows, and days of the week in columns.
0 108 posted 8 years ago by cahyadsn
Given a birthdate in @dob, here are two simple formulae for age in years : (the second formulae is for age in years to two decimal places, ignoring day of month)
0 106 posted 8 years ago by cahyadsn
Instead of the standard return of duplicates, this will actually show the rows that are duplicated, making it easier to see the data
0 95 posted 8 years ago by TheNullByte
add created datetime and modified timestamp columns to table
0 116 posted 8 years ago by navblue
Create a new table from the details of another table then insert the table contents
0 98 posted 8 years ago by imbraz
xxxx1... are tables from master site xxxx2... are tables from client site
0 105 posted 8 years ago by A973C
If you have a Table which has a Column of type char or varchar or even text, and you want to change a portion of text in it for example a path. In this case you need to change the same text with new one in every records.
0 171 posted 8 years ago by klovera
Update an empty name column in default_comments
0 84 posted 8 years ago by jgomez
Example: There is a table, 'user', with a column, 'clear', containing values such as: `clear -------- \'animal\' \'pass'\ ` and we would like to retrieve 'animal' and 'pass' ( without the pre & post \' )
0 158 posted 8 years ago by jgomez
Select wp_users and wp_posts to retrieve data from both tables in order to display post title, post date, author name with gravatar (gravatar isn't listed in this code) Note: probably not idea solution, but it's one of many fixes
0 114 posted 8 years ago by ninacess
Most popular languages on the web table (in order of popularity). Handy for auto complete fields and such.
0 232 posted 8 years ago by Synnoid
Converts textual dates like '1-3-1954' and '01-02-1963' to respectively '1954-3-1' and '1963-02-01'. MySQL is smart enough to understand the values without leading zeros when inserting into a DATE field.
0 134 posted 8 years ago by jpkunst
0 123 posted 8 years ago by irishsk
<h1>What it does</h1> <p>This snippet is used to pull data from one server to another. I primarily use it to get the latest data from our production to our development environments. The first part of the command is where the data is pulling from a...
1 138 posted 8 years ago by nedf23
Used to update a database field using search replace.
0 126 posted 8 years ago by carouselcreative
0 139 posted 8 years ago by athome
Get all page names and ids from the DB of pages with content containing '#'
0 100 posted 9 years ago by nielsenrc
Instrucciones Mysql para crear un nuevo usuario (añadiendo valores a campos existentes en una BBDD existente) y una nueva BBDD con una tabla con cuatro campos a la que tenga acceso el usuario creado.
0 100 posted 9 years ago by alberomo
0 90 posted 9 years ago by hotdiggity
Simple example of how you can output a query as
0 146 posted 9 years ago by Jamie
0 123 posted 9 years ago by mantosz
1 2 3 4 5 ... 8