Samual Sam has Published 2310 Articles

Count top 10 most occurring values in a column in MySQL?

Samual Sam

Samual Sam

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

1K+ Views

To count the top 10 most occurring values in a column in MySQL, The syntax is as follows −SELECT yourColumnName, count(*)    FROM yourTableName    GROUP BY yourColumnName    ORDER BY count(*) DESC    LIMIT 10;To understand the above syntax, let us create a table. The query to create a ... Read More

Get index of given element in array field in MongoDB?

Samual Sam

Samual Sam

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

1K+ Views

You can use $indexOfArray operator for this. Let us create a collection with documents −>db.getIndexDemo.insertOne({"InstructorName":"Chris", "InstructorSubject":["MongoDB", "MySQL", "Java", "C++"]}); {    "acknowledged" : true,    "insertedId" : ObjectId("5cbd5251de8cc557214c0df8") }Display all documents from a collection with the help of find() method −> db.getIndexDemo.find().pretty();This will produce the following output −{    "_id" ... Read More

Duration ofMillis() method in Java

Samual Sam

Samual Sam

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

337 Views

The duration can be obtained in a one millisecond format using the ofMillis() method in the Duration class in Java. This method requires a single parameter i.e. the number of milliseconds and it returns the duration in a one millisecond format. If the capacity of the duration is exceeded, then ... Read More

What the different types of JSTL tags are ?

Samual Sam

Samual Sam

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

646 Views

The JSTL tags can be classified, according to their functions, into the following JSTL tag library groups that can be used when creating a JSP page −Core TagsFormatting tagsSQL tagsXML tagsJSTL Functions

Instant minus() method in Java

Samual Sam

Samual Sam

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

4K+ Views

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

MySQL new user access denied even after giving privileges?

Samual Sam

Samual Sam

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

390 Views

After creating a user and giving all privileges to the user, you need to FLUSH PRIVILEGES to set up and want the new settings to work correctly.The syntax is as follows −FLUSH PRIVILEGES;Here is the query to create a new user which has the name ‘Bob’ in my case. The ... Read More

ByteBuffer get() method in Java

Samual Sam

Samual Sam

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

482 Views

The value at the current position of the buffer is read and then incremented using the method get() in the class java.nio.ByteBuffer. This method returns the value that is at the current buffer position. Also, the BufferUnderflowException is thrown if underflow situation occurs.A program that demonstrates this is given as ... Read More

Deleting all rows older than 5 days in MySQL

Samual Sam

Samual Sam

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

2K+ Views

To delete all rows older than 5 days, you can use the following syntax −delete from yourTableName    where datediff(now(), yourTableName.yourDateColumnName) > 5;Note − Let’s say the current date is 2019-03-10.To understand the concept, let us create a table. The query to create a table is as follows −mysql> create ... Read More

Duration minusMinutes() method in Java

Samual Sam

Samual Sam

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

130 Views

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

Instant truncatedTo() method in Java

Samual Sam

Samual Sam

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

939 Views

An immutable truncated Instant can be obtained using the truncatedTo() method in the Instant class in Java. This method requires a single parameter i.e. the TemporalUnit till which the Instant is truncated and it returns the immutable truncated Instant.A program that demonstrates this is given as follows −Example Live Demoimport java.time.*; ... Read More

Advertisements