Chandu yadav has Published 1276 Articles

Fletcher’s Checksum

Chandu yadav

Chandu yadav

Updated on 30-Jun-2020 07:38:08

2K+ Views

Fletcher checksum is an error – detection technique that uses two checksums to determine single-bit errors in a message transmitted over network channels. It is a block code technique that was devised by John G. Fletcher in 1970s at Lawrence Livermore Labs, USA.The checksums are created based on the data ... Read More

Change date format (in DB or output) to dd/mm/yyyy in PHP MySQL?

Chandu yadav

Chandu yadav

Updated on 30-Jun-2020 07:30:05

2K+ Views

You can change the date format in PHP using date() fucntion. The syntax is as follows −date(d/m/Y, yourDateTimeVariable);In PHP, convert string to date using strtodate(). Here is the PHP code used to format the datetime −$LogintDate = strtotime('2019-01-12'); echo date('d/m/Y', $LogintDate);The snapshot of code is as follows −The following is ... Read More

How to map keys to values for an individual field in a MySQL select query?

Chandu yadav

Chandu yadav

Updated on 30-Jun-2020 07:22:47

2K+ Views

You can use CASE statement in MySQL to map keys to values for an individual field in select query. The syntax is as follows −SELECT yourColumnName1, yourColumnName2, yourColumnName3, .........N (    CASE WHEN yourColumnName = 1 THEN 'ENABLED'    ELSE 'DISABLED'    END ) AS anyVariableName FROM yourTableName;You can use ... Read More

Is `definer` required when creating a MySQL stored procedure?

Chandu yadav

Chandu yadav

Updated on 30-Jun-2020 07:08:41

695 Views

No, definer part is not compulsory when you are creating a stored procedure. It is used when you want to create a definer.Check all the user and host from the MySQL.user table −mysql> select user, host from mysql.user;The following is the output −+------------------+-----------+ | user           ... Read More

MySQL BETWEEN without the beginning and endpoints?

Chandu yadav

Chandu yadav

Updated on 30-Jun-2020 06:56:34

40 Views

If you do not want to include start and end value in between, then use the following syntax −SELECT * FROM yourTableName WHERE yourColumnName BETWEEN yourStartingValue and yourEndingValue and    yourColumnName not in (yourStartingValue , yourEndingValue );To understand the above syntax, let us create a table. The query to create ... Read More

Insert sequential number in MySQL?

Chandu yadav

Chandu yadav

Updated on 30-Jun-2020 06:49:28

602 Views

You can insert sequential number in MySQL using session variable. The syntax is as follows −SELECT @anyVariableName − = anyIntegerValue; UPDATE yourTableName SET yourColumnName = @anyVariableName − = @anyVariableName+IncrementStep;To understand the above syntax, let us create a table. The query to create a table is as follows −mysql> create table ... Read More

How to add static value while INSERT INTO with SELECT in a MySQL query?

Chandu yadav

Chandu yadav

Updated on 30-Jun-2020 06:47:02

9K+ Views

You can add static value when you use INSERT INTO SELECT MySQL query. Write the value directly in the select statement or you can add with the help of variable which initializes the value.Case 1 − Place the value directly in the INSERT INTO SELECT statement. The syntax is as ... Read More

How to Insert custom date into MySQL timestamp field?

Chandu yadav

Chandu yadav

Updated on 30-Jun-2020 06:43:11

1K+ Views

The problem with UNIX_TIMESTAMP() function is that it returns an integer while we want to insert custom date i.e. not any integer part to MySQL date.Do not use UNIX_TIMESTAMP() for your column defined as TIMESTAMP because UNIX_TIMESTAMP() returns an integer.Check the UNIX_TIMESTAMP. The query is as follows −mysql> select UNIX_TIMESTAMP( ... Read More

MySQL Order By specific strings?

Chandu yadav

Chandu yadav

Updated on 30-Jun-2020 06:33:31

120 Views

Order by the choice of strings you want, using the FIELD() function. The syntax is as follows −SELECT *FROM yourTableName ORDER BY FIELD(yourColumnName, ’yourValue1’, ’yourValue2’, ’yourValue3’, ....N);To understand the above syntax, let us create a table. The query to create a table is as follows −mysql> create table OrderByListOfStrings   ... Read More

Iterate through a LinkedList using an Iterator in Java

Chandu yadav

Chandu yadav

Updated on 29-Jun-2020 13:53:57

4K+ Views

An Iterator can be used to loop through an LinkedList. The method hasNext( ) returns true if there are more elements in LinkedList and false otherwise. The method next( ) returns the next element in the LinkedList and throws the exception NoSuchElementException if there is no next element.A program that ... Read More

Previous 1 ... 4 5 6 7 8 ... 128 Next
Advertisements