CoderZone.org

 Category: mySQL

Bookmark and Share

A minus B query - Get contents of table where the item does NOT exist in another table.
Add new user - Example of adding a new mySQL user at the mySQL command prompt.
Add or Subtract days - Use INTERVAL to add or subtract days.
Add random numbers to columns - Add random numbers within a pre-selected range to a given column.
Add string to field - Allows you to add a string to end or start of a field to use when comparing or selecting ...
Almost any date to Mysql date - Handy helper function which parses about any date and returns the same date in ...
Binary RegExp select example - If you really want to force a REGEXP comparison to be case sensitive, use the BI...
Calculate TIMEDIFF with mysql version < 4.1 - Calculate the time difference between two dates with the result i...
CaSe sEnsiTvE query - A query like "select * from customer where name = 'john'" also returns 'John' if it exist...
Change table type - Generate an alter table statement to change table type from myisam to innodb.
Check for duplicates and delete duplicates from database. - Before a user submits data to mysql, check for and ...
Column copy with string replacement - A mySql snippet to copy a column in a table to another column, with some ...
Copy one table to another - Easy way to copy the contents of one table to another table.
Counting rows - A reasonably fast way to get the number of rows in a table.
Create monthly partitions - Create to_days(first_day), to_days(second_day) syntax that can be directly used wh...
Create Random Password - Assign random passwords with a simple mySQL statement.
Detect Daylight Saving Time - To test in other timezones, replace '-5' with your local standard time GMT offset.
Example mySQL DUMP command - An example of creating a mySQL dump from an SSH or Telnet terminal window.
Export table to pipe delimited file - Simplest way to to export a MySQL table to a pipe delimited file.
Extract part of a string - How to extract/select just part of a string.
Fast random row picker #1 - This method of selecting a random row is fairly fast.
Fast random row picker #2 - This will return a random row in about 0.05 seconds, regardless of the size of the ...
Find All Duplicate Rows - A simple bit of SQL that finds duplicate rows in a table. Includes code to find a row...
Find all duplicates in a column - Different ways to find all duplicates in one or more database columns.
Find Worst Performing Indexes - This script shows the top 10 worst indexes (in terms of selectivity %) on the ...
Finding a substring in a string - Easy way to find a substring within a string.
Follow the progress of a mySQL command - Follow the progress of a running MySQL command.
Format numbers to two decimal places - Formatting numbers to two decimal places with mySQL.
Get database and table sizes - Very useful for checking the size of a database or specific tables in a database...
Get HTML/XML output from queries. - The output of this is code that can be cut-and-pasted into your HTML edito...

© coderzone.org | users online: 28