Category: mysql
-
WordPress – Simple Blog Installation in Ubuntu – PHP, Apache, MySQL
Installation #php sudo apt-get install -y php5 #php5 with apache2 sudo apt-get install -y libapache2-mod-php5 #optional: execute standalone php scripts sudo apt-get install -y php5-cli #mysql driver for PHP5 sudo apt-get install -y php5-mysql #unzip sudo apt-get install -y unzip # mysql sudo apt-get install -y mysql # apache webserver sudo apt-get install -y apache2…
-
MySQL – Append text data in column
UPDATE mytable SET mycolumn = CONCAT(mycolumn, ‘this is my appended text’) where id=1234;
-
MySQL – Sorting records/users based on closeness to a age in SQL
Use: sort by users whose age is closest to a defined age. In the example below, 25 years. User Age 1 25 3 23 4 26 5 27 Idea: select abs(u_age-25) as age_difference, u_age from users order by age_difference, u_age; The MySQL function abs ensures that the subtracted result is always positive. The date of…