Rishi Rathor has Published 155 Articles

Get the difference between two timestamps in seconds in MySQL?

Rishi Rathor

Rishi Rathor

Updated on 30-Jul-2019 22:30:24

409 Views

To get difference between two timestamps in seconds, use two in-built functions TIME_TO_SEC() and TIMEDIFF() in MySQL. The syntax is as follows −select time_to_sec(timediff(yourCoulnName1, yourCoulnName2)) as anyVariableName from yourTableName;To understand the above concept, let us first create a table. The query to create a table.mysql> create table TimeToSecond ... Read More

Set column charset in MySQL?

Rishi Rathor

Rishi Rathor

Updated on 30-Jul-2019 22:30:24

435 Views

Set column charset using character SET command. The syntax is as follows −ALTER TABLE yourTableName MODIFY youColumName type CHARACTER SET anyCharcaterSetName;You can use character set name utf8 or something elsE. To set column charset, let us first create a table. The query to create a table is as follows −mysql> ... Read More

Display all tables inside a MySQL database using Java?

Rishi Rathor

Rishi Rathor

Updated on 30-Jul-2019 22:30:24

1K+ Views

We will see here how to display all tables inside a MySQL database using Java. You can use show command from MySQL to get all tables inside a MySQL database.Let’s say our database is ‘test’. The Java code is as follows to show all table names inside a database ‘test’.The ... Read More

MySQL add days to a date?

Rishi Rathor

Rishi Rathor

Updated on 30-Jul-2019 22:30:24

3K+ Views

To add days to a date, you can use DATE_ADD() function from MySQL. The syntax is as follows to add days to a date −INSERT INTO yourTableName VALUES(DATE_ADD(now(), interval n day));In the above syntax, you can use curdate() instead of now(). The curdate() will store only date while now() will ... Read More

How to display the value of a variable on command line in MySQL?

Rishi Rathor

Rishi Rathor

Updated on 30-Jul-2019 22:30:24

3K+ Views

To display the value of a variable, you can use select statement. The syntax is follows −SELECT @yourVariableName;Let us first create a variable. This can be done using SET command. The following is the syntax to create a variable −SET @yourVariableName = yourValue;Let us check the above syntax to create ... Read More

MySQL Query to change lower case to upper case?

Rishi Rathor

Rishi Rathor

Updated on 30-Jul-2019 22:30:24

7K+ Views

You can use in-built function UPPER() from MySQL to change a lower case to upper case. The syntax is as follows with select statement.SELECT UPPER(‘yourStringValue’);The following is an example showing string in lower case −mysql> select upper('john');Here is the output displaying string in upper case −+---------------+ | upper('john') | +---------------+ ... Read More

MySQL Sum Query with IF Condition?

Rishi Rathor

Rishi Rathor

Updated on 30-Jul-2019 22:30:24

6K+ Views

The Sum() is an aggregate function in MySQL. You can use sum query with if condition. To understand the sum query with if condition, let us create a table.The query to create a table −mysql> create table SumWithIfCondition    −> (    −> ModeOfPayment varchar(100)    −> ,    −> ... Read More

How to adjust display settings of MySQL command line?

Rishi Rathor

Rishi Rathor

Updated on 30-Jul-2019 22:30:24

913 Views

To adjust display settings of MySQL command line, use the /G at the end of MySQL queries instead of semicolon(;).The syntax is as follows −SELECT *FROM yourTableName \GThe above syntax adjusts the display settings. Here we will display records in row format from our sample ‘studenttable’ table which we created ... Read More

Can Google Analytics track interactions in an offline HTML5 app?

Rishi Rathor

Rishi Rathor

Updated on 30-Jul-2019 22:30:22

161 Views

Google Analytics is a freemium analytic tool that provides a detailed statistics of the web traffic. It is used by more than 60% of website owners. Analytics Tools offer an insight into the performance of your website, visitors’ behavior, and data flow. These tools are inexpensive and easy to use. ... Read More

To “user-scalable=no” or not to “user-scalable=no” in HTML5

Rishi Rathor

Rishi Rathor

Updated on 30-Jul-2019 22:30:22

154 Views

For responsive design, you do not have to use user-scalable=no. Use it only if you want your application to look more like a native app.Zooming is a key feature for accessibility and you need to keep that in mind. You can control that users won't break your design if they ... Read More

Advertisements