Entries Tagged ‘MySQL’:

How To Use Triggers to Track Changes in MySQL

Setting constraints and rules in the database is better than writing special code to handle the same task since it will prevent another developer from writing a different query that bypasses all of the special code and could leave your database with poor data integrity.

addthis_url = ‘http%3A%2F%2Fcodespatter.com%2F2008%2F05%2F06%2Fhow-to-use-triggers-to-track-changes-in-mysql%2F’;
addthis_title [...]

Swap Insert for Update When Key Exists

When synchronizing tables or databases, sometimes it is useful to have a way to update a row if there is already an entry for a key. Using the MySQL syntax, ON DUPLICATE KEY UPDATE, it is possible to insert a row if it doesn’t exist or update it if there is already a row with [...]

Multiple Inserts with a Subquery

Inserting multiple rows into a table is simple.

INSERT INTO table1 (id) VALUES (1), (2)

But what if you want to use a subquery to replace the explicit query with something more dynamic. This should be possible, however, searching the internet didn’t get me (or my colleagues) any closer to figuring this out. The obvious attempt of [...]

How to Break a MySQL Left Join

Care must be taken when placing conditions on the results of the right-hand table of a LEFT JOIN because it could easily become a normal JOIN since MySQL is using a NULL row for every column in the right-hand table when no records exist.

addthis_url = ‘http%3A%2F%2Fcodespatter.com%2F2008%2F02%2F19%2Fhow-to-break-a-mysql-left-join%2F’;
addthis_title = [...]

CyTE g9 Released

CyTE g9 is now available for download.
See
http://cyte.googlecode.com for all versions.
Miscellaneous Changes

Added the include_files function to the utility functions. It will include all files in a directory. Used for including all files in the classes directory. (make sure dependencies are required in the class file since the order in which this function includes is … [...]