Jennifer Nicholas has Published 329 Articles

How to bulk update MySQL data with a single query?

Jennifer Nicholas

Jennifer Nicholas

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

6K+ Views

You can bulk update MySQL data with one query using CASE command. The syntax is as follows −update yourTableName set yourUpdateColumnName = ( Case yourConditionColumnName WHEN Value1 THEN ‘’UpdatedValue’ WHEN Value2 THEN ‘UpdatedValue’ . . N END) where yourConditionColumnName IN(Value1, Value2, .....N);To understand the above concept, let us create a ... Read More

MySQL syntax not evaluating with not equal operator in presence of null?

Jennifer Nicholas

Jennifer Nicholas

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

113 Views

Use the IS NOT NULL operator to compare with NULL values. The syntax is as follows −SELECT *FROM yourTableName where yourColumnName1 is not null or yourColumnName2 anyIntegerValue;To check the not equal to in presence of null, let us create a table. The query to create a table is as ... Read More

Can we update MySQL with if condition?

Jennifer Nicholas

Jennifer Nicholas

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

409 Views

You can update MySQL with IF condition as well as CASE statement. For this purpose, let us first create a table. The query to create a table −mysql> create table UpdateWithIfCondition    −> (    −> BookId int,    −> BookName varchar(200)    −> ); Query OK, 0 rows affected ... Read More

How to get the Average on MySQL time column?

Jennifer Nicholas

Jennifer Nicholas

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

1K+ Views

To get average on time column, use the below syntax. It will give the average in time format −SELECT SEC_TO_TIME(AVG(TIME_TO_SEC(yourColumnName))) as anyVariableName from yourTableName;To understand the above concept, let us create a table. The following is the query −mysql> create table AverageOnTime    −> (    −> PunchInTime time   ... Read More

Increase and decrease row value by 1 in MySQL with Stored Procedure?

Jennifer Nicholas

Jennifer Nicholas

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

568 Views

Let us first create a table to increase and adecrease row value by 1. The following is the query −mysql> create table IncrementAndDecrementValue    −> (    −> UserId int,    −> UserScores int    −> ); Query OK, 0 rows affected (0.60 sec)Insert some records in the table using ... Read More

MySQL difference between two timestamps in Seconds?

Jennifer Nicholas

Jennifer Nicholas

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

203 Views

You can use in-built function UNIX_TIMESTAMP() from MySQL to get the timestamps and the difference between two timestamps. The syntax is as follows −SELECT UNIX_TIMESTAMP(yourColumnName1) - UNIX_TIMESTAMP(yourColumnName2) as anyVariableName from yourTableName;To understand the above concept, let us create a table. The following is the query to create a table −mysql> ... Read More

HTML5 geolocation 'permission denied' error in Mobile Safari

Jennifer Nicholas

Jennifer Nicholas

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

361 Views

Whenever a mobile website is created and there is a requirement in which user is requested for current position on button click, then HTML5 geolocation is used.This is working fine in mobile chrome.However when in Mobile Safari, the user is prompted to share location and browser defaults to geolocation then ... Read More

The auto storage class in C++

Jennifer Nicholas

Jennifer Nicholas

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

177 Views

In C, The auto storage class specifier lets you explicitly declare a variable with automatic storage. The auto storage class is the default for variables declared inside a block. A variable x that has automatic storage is deleted when the block in which x was declared exits.You can only apply ... Read More

Operators Precedence in C++

Jennifer Nicholas

Jennifer Nicholas

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

15K+ Views

Operator precedence determines the grouping of terms in an expression. The associativity of an operator is a property that determines how operators of the same precedence are grouped in the absence of parentheses. This affects how an expression is evaluated. Certain operators have higher precedence than others; for example, the ... Read More

Advertisements