get the difference between two timestamps in seconds

get the difference between two timestamps in seconds   You could use the TIMEDIFF() and the TIME_TO_SEC() functions as follows: SELECT TIME_TO_SEC(TIMEDIFF(‘2010-08-20 12:01:00’, ‘2010-08-20 12:00:00’)) diff; +——+ | diff | +——+ | 60 | +——+ 1 row in set (0.00 sec) You could also use the UNIX_TIMESTAMP() function. SELECT UNIX_TIMESTAMP(‘2010-08-20 12:01:00’) – UNIX_TIMESTAMP(‘2010-08-20 12:00:00’) diff; +——+ | diff | +——+ | … Read more

mysql length function : calculate length of a column

mysql 5.7

mysql length function : calculate length of a column Function length() Return the length of the string Usages SELECT CustomerName, LENGTH(CustomerName) AS LengthOfName FROM Customers; Tablenames Records Customers 91 Categories 8 Employees 9 OrderDetails 2155 Orders 830 Products 77 Shippers 3 Suppliers 29    

Install mysql on centos linux

mysql 5.7

Install mysql on centos linux Reference : https://blog.eduguru.in/linux-2/install-lamp-server-apache-mysql-php-on-rhel-centos-scientific-linux-6-56-4 Install MySQL MySQL is an enterprise class, open source, world’s second most used database. MySQL is a popular choice of database for use in web applications, and is a central component of the widely used LAMP open source web application software stack. To install MySQL, enter the following … Read more

MySQL conditional expression CASE

MySQL conditional expression CASE MySQL CASE expression is a conditional expression that allows you to construct conditions inside a query such as SELECT or WHERE clause.   CASE WHEN condition_1 THEN result_1 WHEN condition_2 THEN result_2 … ELSE result END The CASE expression returns the result such as result_1, result_2, etc., if the condition is true. If all conditions are false, then the result in the ELSE part … Read more

MySQL 5.7 features

mysql 5.7

MySQL 5.7 features MySQL 5.7 is the best release ever of the world’s most popular open source database and provides a new, advanced feature set designed to enable those who are building the next generation of web-based and embedded applications and services.  — Ref. https://www.mysql.com/why-mysql/white-papers/whats-new-mysql-5-7/ Multi-source Replication 3x Faster Performance New Optimizer Native JSON Support GIS … Read more

MySQL service uptime

MySQL service uptime   Sometimes, we need to check the uptime for MySQL in our server. There are multiple method to check the uptime status of mysql server. Let see some of them. mysqladmin status [root@localhost ~]# mysqladmin -u root -p********* status Uptime: 225921 Threads: 10 Questions: 18469911 Slow queries: 0 Opens: 12466 Flush tables: 1 … Read more

Replication with Different Master and Slave Storage Engines

mysql master - slave replication

Replication with Different Master and Slave Storage Engines It does not matter for the replication process whether the source table on the master and the replicated table on the slave use different engine types. In fact, the default_storage_engine and storage_engine system variables are not replicated. Even this provides a number of benefits in the replication … Read more

MySQL : Dumping Data in SQL Format with mysqldump

MySQL : Dumping Data in SQL Format with mysqldump   By default, mysqldump writes information as SQL statements to the standard output. You can save the output in a file: shell> mysqldump [arguments] > file_name To dump all databases, invoke mysqldump with the –all-databases option: shell> mysqldump –all-databases > dump.sql To dump only specific databases, name them on the command line … Read more

Download HeidiSQL

Download HeidiSQL   Installer, 32/64 bit combined Portable version (zipped): 32 bit , 64 bit Microsoft Store App, 32 bit Sourcecode   HeidiSQL runs fine on Windows XP, Vista, 7, 8 and 10. Running on Wine requires to override Wine’s builtin Direct2D library with the native one. Previous installers can be downloaded here.     HeidiSQL is a useful and … Read more