- Category: Hippy Philosophy
Bishop Berkeley espoused the school of thought called Idealism, which went along the lines of: "To be, is to be perceived". One fyne day he dreamt the following conundrum up: "If a tree falls in the forest and no one hears it, does it make a sound?" The implication is that if no one perceives the event, not only does the tree not make a sound, but the tree does not even exist.
This is, of course, a load of old rubbish. The good Bishop can't do me for defamation since he ceased being perceived in 1753. Had he lived in today's more cynical world, he may well have come up with more relevent thought-experiments to illustrate the philosophy of Idealism, thus:
- Category: MySQL
... without destroying the database.
You can do it all in the shell:
- Create a SQL script from the database to drop all the tables
- Execute the SQL script against the database
mysql -u[pwd] -p[user] [dbname] -s -e 'show tables' | sed -e 's/^/drop table /' -e 's/$/;/' > dropalltables.sql
mysql -u[pwd] -p[user] [dbname] < dropalltables.sql
- Category: MySQL
A quick and dirty way of stripping duplicate records out of a MySQL table!, if your table has no indexes or constraints:
Assuming the name of the offending table is customers:
CREATE TABLE customer_dedupe AS SELECT DISTINCT * FROM customers;
RENAME TABLE customers TO customers_dupe;
RENAME TABLE customers_dedupe TO customers;
But what if your original table had indexes?
- Category: SQL Server
The task of matching strings between heterogeneous systems, especially that of matching personal or company names or addresses, is not easy with SQL Server's limited set of built-in string SQL functions. Here is a C# CLR-Assembly (with source code) for SQL Server with some advanced string-handling functions that may help:
LTrim - like Oracle's LTRIM function.
InitCap - like Oracle's INITCAP function
FlattenCharSet - Replace western characters with diacritics with best-choice, non-diacritic characters
StripPunctuationMarks - Remove all punctiation marks from the given string.
Page 3 of 6