checkedresponsive[@]gmail.com

Menu

Category: MySQL

mysql-tutorials

How to count rows in a table ?

How to count rows in a table ? SELECT TABLE_NAME, TABLE_ROWS FROM `information_schema`.`tables` WHERE `table_schema` = ‘YOUR_DB_NAME’;

MySQL Email column validation | MySQL Email Validation

MySQL Email Validation Simple code to remove duplicate email ids in MySQL and validation the email column also. Show only Valid Email records Example :- SELECT distinct email, email REGEXP ‘^[A-Za-z0-9._%\-+!#$&/=?^|~]+@[A-Za-z0-9.-]+[.][A-Za-z]+$’ AS valid_email FROM enquiry having valid_email > 0 Packers and Movers in Dubai

MySQL | Locate | Find text or word in MySQL

MySQL – Locate : Syntax :- SELECT LOCATE(‘<< Find STRING >>’,‘<< COLUMN or VALUE’); Result : Return the string position Example :- SELECT LOCATE(‘Singapore’,‘Malaysia, Singapore’);

MySQL | Find and Replace text in Column value

Find and Replace text in Column value The below example shows the find and replace text in column values in MySQL tables. Syntax : UPDATE `<Table Name>` SET `<Field Name>` = replace(fieldName,  FIND_TEXT,  REPLACE_TEXT) Example : UPDATE `Employee` SET `allImageURLsMobile` = replace(allImageURLsMobile, ‘/ids/’, ‘/ids/mobile/’)

How to get last one hour data in MySQL ?

Last one Hour data in MySQL ? Example :- select o.code, o.customerId, c.name, c.email from `Order` o’; join Customer c on c.id = o.customerId ‘; where o.orderDate >= DATE_SUB(NOW(),INTERVAL <<SYNTAX>> HOUR) order by o.id limit 0, 2 Example :- select o.code, o.customerId, c.name, c.email from `Order` o’; join Customer c on c.id = o.customerId ‘; […]

How to clone table in MySQL ?

Table Clone in MySQL Copy a existing table structure and datas into new table CREATE TABLE enquirydetail1 LIKE enquirydetail; INSERT enquirydetail1 SELECT * FROM enquiry;

How to import table from other database in MySQL

Import a record from other Database How to import a record from another database table in mysql ? Same Table Structure in Source and Destination Table INSERT INTO <TABLENAME> SELECT * FROM <DESTINATION DATABASENAME>.<TABLENAME> Transfer from Limited Fields INSERT INTO <TABLENAME> (col1, col2) SELECT (col1, col2) FROM <DESTINATION DATABASENAME>.<TABLENAME> Transfer from Limited Fields with Condition INSERT […]

How to import CSV file into Table in MySQL ?

Import CSV File into MySQL Table This below example shows you how to use the LOAD DATA INFILE statement to import CSV file into MySQL table. The LOAD DATA INFILE statement allows you to read data from a text file and import the file’s data into a database table very fast. Before importing the file, […]

Insert a row no in new column in MySQL

Add a row no. in new column Update a column with record row no in MySQL Execute the below query in Mysql to update an row no. in the specified column   My Sql Query Example  SET @pos := 0 UPDATE userinfo SET fuserid = ( SELECT @pos := @pos + 1 ) ORDER BY […]