MySQL

Common MySQL Queries with MySQL 5&6

Posted by Jiltin     Tags: 17 April, 2009    354 views    (2) Comment

This is not my own script. I found this very useful from the net and copied here or my reference: Basic aggregation This is the simplest grouping query pattern. For column foo, display the first (smallest), last (largest) or average value of column bar: SELECT foo, MIN(bar) AS bar FROM tbl GROUP BY foo Return the highest bar value for each foo, ordering top to bottom by that value: SELECT foo, MAX(bar) AS Count FROM tbl GROUP BY foo ORDER BY Count DESC; Ditto for AVG(), COUNT() etc. The Read Full Article (Click here)...

Categories : MySQL Tags :

MySQL snippets – CREATE TABLE statement sample as bash shell.

Posted by Jiltin     Tags: , 15 April, 2009    180 views    (0) Comment

The CREATE TABLE statement is used to create a table in MySQL. Syntax: CREATE TABLE table_name ( column_name1 data_type, column_name2 data_type, column_name3 data_type, …. ) sample #!/bin/sh # # Developed by jiltin # Shows all users and the user status # #mysql> desc user_transactions; #+——————+————-+——+—–+——————-+——-+ #| Field       Read Full Article (Click here)...

Categories : MySQL, Web Mysql Tags : ,

How to install LAMP (Linux, apache, php, mysql) – Blogging – Make It Easy?

Posted by Jiltin     Tags: , , , , 24 March, 2009    608 views    (0) Comment

How to install LAMP (Linux, apache, php, mysql)? Here is the simple way to create your own LAMP and starting blogging right away. The easiest way to install LAMP using yum program in CentOS. Below are the steps to install LAMP (Apache, PHP and MySQL in Linux) using Yum:- * Go to CentOS and download a copy of CentOS Linux and install it (I will not go thru the how to install CentOS with you here – ) * Once your CentOS is installed. Open a terminal (if you are using X-Window), and type Read Full Article (Click here)...

Categories : MySQL, Scripts Unix, Web & Scripts Tags : , , , ,

PHP MySQL example: image gallery (blob-storage) – Source anyexample.com

Posted by Jiltin     Tags: , , 22 February, 2009    508 views    (0) Comment

I wanted to store an image in mysql tables. Just googled, and got a working example from anyexample.com. A minor change is required for the script. Instead of echo "<a href=’{$PHP_SELF}?show={$id}’>{$title}</a> &ndash; "; it should be echo "<a href=" . $PHP_SELF . "?show={$id}’>{$title}</a> &ndash; "; Here is the script details reproduced from original page: This is a simple example of photo-gallery Read Full Article (Click here)...

Categories : MySQL, Web & Scripts Tags : , ,

Regular Expression with MySQL – A very cool and powerful capability

Posted by Jiltin     Tags: , , 18 February, 2009    241 views    (1) Comment

A very cool and powerful capability in MySQL and other databases is the ability to incorporate regular expression syntax when selecting data. The regular expresion support in MySQL is extensive. This recipe reviews regular expression use in MySQL and lists the supported regular expression metacharacters. The basic syntax to use regular expressions in a MySQL query is: SELECT something FROM TABLE WHERE COLUMN REGEXP ‘regexp’ SELECT post_content FROM wp_posts WHERE post_content Read Full Article (Click here)...

Categories : MySQL, Web & Scripts Tags : , ,