Karthikeya Boyini has Published 2383 Articles

MySQL select dates in 30-day range?

karthikeya Boyini

karthikeya Boyini

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

1K+ Views

To select dates in 30-day range, you can use arithmetic operation - with interval.The syntax is as follows −select *from yourTableName where yourDateColumnName > NOW() - INTERVAL 30 DAY and yourDateColumnName < NOW() + INTERVAL 30 DAY;To understand the above syntax, let us create a table. The query to create ... Read More

How to query MongoDB using the $ne operator?

karthikeya Boyini

karthikeya Boyini

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

93 Views

To query MongoDB using the $ne operator, following is the syntax −db.yourCollectionName.find({yourFieldName:{$ne:yourValue}}).pretty();Let us create a collection with documents −> db.notEqaulToDemo.insertOne({"StudentName":"Larry", "StudentMathMarks":68}); {    "acknowledged" : true,    "insertedId" : ObjectId("5cbd3a6bde8cc557214c0ded") } > db.notEqaulToDemo.insertOne({"StudentName":"Chris", "StudentMathMarks":88}); {    "acknowledged" : true,    "insertedId" : ObjectId("5cbd3a79de8cc557214c0dee") } > db.notEqaulToDemo.insertOne({"StudentName":"David", "StudentMathMarks":45}); {    "acknowledged" ... Read More

Duration hashCode() method in Java

karthikeya Boyini

karthikeya Boyini

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

110 Views

The hash code value of the duration can be obtained using the hashCode() method in the Duration class in Java. This method requires no parameters and it returns the hash code value of the duration.A program that demonstrates this is given as follows −Example Live Demoimport java.time.Duration; public class Demo { ... Read More

Create Triplet Tuple from Array in Java

karthikeya Boyini

karthikeya Boyini

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

98 Views

To create a Triplet tuple from Array in Java, you need to use the fromArray() method.Let us first see what we need to work with JavaTuples. To work with Triplet class in JavaTuples, you need to import the following package −import org.javatuples.Triplet;Note − Steps to download and run JavaTuples program ... Read More

Instant plus() method in Java

karthikeya Boyini

karthikeya Boyini

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

2K+ Views

An immutable copy of a instant where a time unit is added to it can be obtained using the plus() method in the Instant class in Java. This method requires two parameters i.e. time to be added to the instant and the unit in which it is to be added. ... Read More

ByteBuffer duplicate() method in Java

karthikeya Boyini

karthikeya Boyini

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

310 Views

A duplicate buffer of a buffer can be created using the method duplicate() in the class java.nio.ByteBuffer. This duplicate buffer is identical to the original buffer. The method duplicate() returns the duplicate buffer that was created.A program that demonstrates this is given as follows −Example Live Demoimport java.nio.*; import java.util.*; public ... Read More

How to remove hyphens using MySQL UPDATE?

karthikeya Boyini

karthikeya Boyini

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

682 Views

To remove hyphens using MySQL update, you can use replace() function. The syntax is as follows −update yourTableName    set yourColumnName=replace(yourColumnName, '-', '' );To understand the above syntax, let us create a table. The query to create a table is as follows −mysql> create table removeHyphensDemo    -> (   ... Read More

Get the count of the number of documents in a MongoDB Collection?

karthikeya Boyini

karthikeya Boyini

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

158 Views

To get the count of the number of documents in a collection MongoDB, you can use the below syntax −db.getCollectionNames().map(function(anyVariableName) {    return { "yourVariableName": yourVariableName, "count": db[yourVariableName].count() } });Here, we are using ‘test’ database.Let us implement the above syntax to get the count of the number of documents in ... Read More

Duration minusSeconds() method in Java

karthikeya Boyini

karthikeya Boyini

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

80 Views

An immutable copy of a duration where some seconds are removed from it can be obtained using the minusSeconds() method in the Duration class in Java. This method requires a single parameter i.e. the number of seconds to be subtracted and it returns the duration with the subtracted seconds.A program ... Read More

Instant isSupported() method in Java

karthikeya Boyini

karthikeya Boyini

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

103 Views

It can be checked if a ChronoUnit is supported by the Instant class or not by using the isSupported() method in the Instant class in Java. This method requires a single parameter i.e. the ChronoUnit to check. It returns true if the ChronoUnit is supported by the Instant class and ... Read More

Advertisements