Showing posts with label database. Show all posts
Showing posts with label database. Show all posts

Friday, June 21, 2013

MySQL foreign key constraints


Below are explanations for MySQL's foreign key constraints:

1. ON DELETE RESTRICT

This means that a given parent row cannot be deleted if a child row referencing to it exists. It can be deleted only if there are no referencing child rows.
Modern database systems make this clause redundant as this would be default behavior of any foreign key. I am not sure which versions of MySQL include this as default, still wouldn't hurt keeping this clause.


2. ON DELETE CASCADE

ON DELETE CASCADE means that if a given parent row is deleted then all referencing child rows will also be deleted.

3. ON DELETE SET NULL

ON DELETE SET NULL means that if a given parent row is deleted then all referencing child rows will be set to NULL.

4.  ON DELETE NO ACTION

Same as ON DELETE RESTRICT, that is, a given parent row cannot be deleted if a child row referencing to it exists.

Monday, November 23, 2009

Examples of Flash Charts and Graphs soon

I will try to upload some examples and screen-shots of some graphs and charts generated through Flash which gets in the data from databases or XML files.

Check in soon!

Thursday, July 10, 2008

Fixing MySQL Problem - Unable to connect via socket

A common problem I saw with MySQL, after a system update (10.4.4) or on later systems (Leopard on PPC computers) there are problems connecting via the MySQL Socket, it says the socket file not found.

Apparently is it because the socket file got moved during the update [http://www.macosxhints.com/article.php?story=20060111113313511]. To repair this problem, open the Terminal and enter the following commands:
$ sudo mkdir /var/mysql

$ sudo ln -s /tmp/mysql.sock /var/mysql/mysql.sock
The first line is creating a folder called "mysql" inside the "var" folder at the root level, the second line is making a link called "mysql.sock" to the actual "mysql.sock" file (at the changed location) inside the invisible "tmp" folder.

Do this and you should be fine again.

You might want to look at:
  • http://en.wikipedia.org/wiki/Ln_(Unix)
  • http://en.wikipedia.org/wiki/Mkdir
  • http://en.wikipedia.org/wiki/Sudo
  •