Posts

Showing posts with the label mysql

Replace and update in mysql query

Image
 Table Name=packers Column=contactNo 8964828952, 8964828951 8964828952, 8964828951 want to replace every    8964828952 to  9109595911 from contctNo column UPDATE   packers   SET   contactNo   =   REPLACE ( contactNo ,   '8964828952' ,   '9109595911' )

Remove anything from table's column in mysql using query

Image
    If you want to remove anything from your table column values. Suppose in yourtable have column name email and all email values have ,(comma). Example : abc@gmail.com, UPDATE YourTable SET ` email ` = REPLACE(` email `, ',' , '' ) WHERE ` email ` like '%,%' ;  

how to remove key constraint of column in mysql?

Image
  ALTER TABLE `table` MODIFY `id` INT ; ALTER TABLE `table` DROP PRIMARY KEY ;

Order a MySQL table by two columns

Image
  ORDER BY article_rating DESC, article_time DESC

Rename a table in MySQL

Image
    Try any of these RENAME TABLE `group` TO `member` ; or ALTER TABLE `group` RENAME `member` ;

SQL Database Table Joins - Inner,Left,Right and Outer For Every Develope...

Image

MySQL date format DD/MM/YYYY select query?

  You can use STR_TO_DATE() to convert your strings to MySQL date values and ORDER BY the result: ORDER BY STR_TO_DATE(datestring, '%d/%m/%Y') However, you would be wise to convert the column to the DATE data type instead of using strings.

how to take backup of mysql database using php ?

  $dbhost = $_SERVER[ 'SERVER_NAME' ]; $dbuser = 'root' ; $dbpass = '' ; $dbname = 'marketing' ; $connection = mysqli_connect($dbhost, $dbuser, $dbpass, $dbname); $backupAlert = '' ; $tables = array (); $result = mysqli_query($connection, "SHOW TABLES" ); if (!$result) { $backupAlert = 'Error found.<br/>ERROR : ' . mysqli_error($connection) . 'ERROR NO :' . mysqli_errno($connection); } else { while ($row = mysqli_fetch_row($result)) { $tables[] = $row[ 0 ]; } mysqli_free_result($result); $return = '' ; foreach ($tables as $table) { $result = mysqli_query($connection, "SELECT * FROM " . $table); if (!$result) { $backupAlert = 'Error found.<br/>ERROR : ' . mysqli_error($connection) . 'ERROR NO :' . mysqli_errno($connection); ...

how to take backup of mysql database using php

$dbhost = $_SERVER[ 'SERVER_NAME' ]; $dbuser = 'root' ; $dbpass = '' ; $dbname = 'marketing' ; $connection = mysqli_connect($dbhost, $dbuser, $dbpass, $dbname); $backupAlert = '' ; $tables = array (); $result = mysqli_query($connection, "SHOW TABLES" ); if (!$result) { $backupAlert = 'Error found.<br/>ERROR : ' . mysqli_error($connection) . 'ERROR NO :' . mysqli_errno($connection); } else { while ($row = mysqli_fetch_row($result)) { $tables[] = $row[ 0 ]; } mysqli_free_result($result); $return = '' ; foreach ($tables as $table) { $result = mysqli_query($connection, "SELECT * FROM " . $table); if (!$result) { $backupAlert = 'Error found.<br/>ERROR : ' . mysqli_error($connection) . 'ERROR NO :' . mysqli_errno($connection); ...