Karthikeya Boyini has Published 2192 Articles

How to remove hyphens using MySQL UPDATE?

karthikeya Boyini

karthikeya Boyini

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

937 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

244 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

166 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

166 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

ByteBuffer compareTo() method in Java

karthikeya Boyini

karthikeya Boyini

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

172 Views

A buffer can be compared with another buffer using the method compareTo() in the class java.nio.ByteBuffer. This method returns a negative integer if the buffer is less than the given buffer, zero if the buffer is equal to the given buffer and a positive integer if the buffer is greater ... Read More

MySQL select order by acts like a string (not a number)?

karthikeya Boyini

karthikeya Boyini

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

220 Views

You can use the following syntax if your column has varchar data type −select yourColumnName FROM yourTableName ORDER BY yourColumnName +0 DESC;To understand the above syntax, let us create a table. The query to create a table is as follows −mysql> create table selectOrderdemo    -> (    -> Id ... Read More

MySQL Merge selects together?

karthikeya Boyini

karthikeya Boyini

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

212 Views

To merge selects together, you need to use GROUP BY clause. To understand the concept, let us create a table. The query to create a table is as follows −mysql> create table MergingSelectDemo    -> (    -> RoomServicesId int,    -> RoomId int,    -> ServiceId int    -> ... Read More

Search a value in JavaTuples Triplet class

karthikeya Boyini

karthikeya Boyini

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

97 Views

Use the contains() method to search a value in Triplet class.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 If you are using Eclipse ... Read More

Instant parse() method in Java

karthikeya Boyini

karthikeya Boyini

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

315 Views

The string representation of an Instant can be obtained using the toString() method in the Instant class in Java. This method requires no parameters and it returns the string representation of the Instant.A program that demonstrates this is given as follows −Example Live Demoimport java.time.*; public class Demo { ... Read More

How to copy data from one field to another on every row in MySQL?

karthikeya Boyini

karthikeya Boyini

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

2K+ Views

To copy data from one field to another on every row, use the UPDATE command.Let us first create a table −mysql> create table DemoTable    (    StudentId int,    StudentFirstName varchar(20),    StudentMarks int default 0    ); Query OK, 0 rows affected (0.49 sec)Following is the query to ... Read More

Advertisements