Select a Location
PSOUG Home Page
Oracle Code Library
mySQL Code Library
PHP Code Library
Oracle Terms & Definitions
Oracle Error Codes
Advanced Code Search
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 give...
Add string to field
- Allows you to add a string to end or start of a field to use when ...
Almost any date to Mysql date
- Handy helper function which parses about any date and re...
Binary RegExp select example
- If you really want to force a REGEXP comparison to be cas...
Calculate TIMEDIFF with mysql version < 4.1
- Calculate the time difference between two ...
CaSe sEnsiTvE query
- A query like "select * from customer where name = 'john'" also ret...
Change table type
- Generate an alter table statement to change table type from myisam t...
Check for duplicates and delete duplicates from database.
- Before a user submits data t...
Column copy with string replacement
- A mySql snippet to copy a column in a table to ano...
Copy one table to another
- Easy way to copy the contents of one table to another table.
- A very fast way to get the number of rows in a table is doing this.
Create monthly partitions
- Create to_days(first_day), to_days(second_day) syntax that ...
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 s...
Export table to pipe delimited file
- Simplest way to to export a MySQL table to a pipe ...
Extract part of a string
- How to extract/select just part of a string.
- Alternate code for versions of mySQL that don't have the UNION function.
Fast random row picker one
- This method of selecting a random row is fairly fast.
Fast random row picker two
- This will return a random row in about 0.05 seconds, regard...
Find all duplicates in a column
- Easy ways to find all duplicates in a database column(s)n.
- Finds duplicate rows. Also shows code to find a row that occurs only once.
Find Worst Performing Indexes
- This script shows the top 10 worst indexes (in terms of...
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 HTML and XML output from queries.
- The output of this is code that can be cut-and-...
Get MySQL Database Size
- Useful shell commands for determining overall DB size.
© 2003 - 2023 psoug.org