Samual Sam has Published 2310 Articles

How do I insert a special character such as ' (single quote) into MySQL?

Samual Sam

Samual Sam

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

4K+ Views

To insert a special character such as “ ‘ “ (single quote) into MySQL, you need to use \’ escape character. The syntax is as follows −insert into yourTableName(yourColumnName) values(' yourValue\’s ');To understand the above syntax, let us create two tables. The query to create first table is as follows ... Read More

The contains() method of Pair Class in JavaTuples

Samual Sam

Samual Sam

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

295 Views

Search a value in a Pair Class using the contains() method.Let us first see what we need to work with JavaTuples. To work with Pair class in JavaTuples, you need to import the following package −import org.javatuples.Pair;Note − Steps to download and run JavaTuples program If you are using Eclipse ... Read More

How do you implement hit counter in JSP?

Samual Sam

Samual Sam

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

490 Views

A hit counter tells you about the number of visits on a particular page of your web site. Usually, you attach a hit counter with your index.jsp page assuming people first land on your home page.To implement a hit counter you can make use of the Application Implicit object and ... Read More

MonthDay with() Method in Java

Samual Sam

Samual Sam

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

92 Views

An immutable copy of a MonthDay with the month of the year altered as required is done using the method with() in the MonthDay class in Java. This method requires a single parameter i.e. the month that is to be set in the MonthDay and it returns the MonthDay with ... Read More

How to remove duplicate values inside a list in MongoDB?

Samual Sam

Samual Sam

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

1K+ Views

You can use aggregate framework along with $setUnion operator. Let us first create a collection with documents −> db.removeDuplicatesDemo.insertOne({"InstructorName":"Chris", "InstructorAge":34, "InstructorSubject":    ["Java", "C", "Java", "C++", "MongoDB", "MySQL", "MongoDB"]}); {    "acknowledged" : true,    "insertedId" : ObjectId("5cb9d96c895c4fd159f80807") }Following is the query to display all documents from the collection with ... Read More

How to read a specific key-value pair from a MongoDB collection?

Samual Sam

Samual Sam

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

919 Views

You can use dot(.) notation to read a specific key-value pair from MongoDB collection. Let us first create a collection with documents −> db.readSpecificKeyValueDemo.insertOne( ...    { ...       "_id": 100, ...       "StudentDetails": ...       { ...          "StudentFirstName" : ... Read More

JavaTuples setAt0() method for Quartet class

Samual Sam

Samual Sam

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

109 Views

The setAt0() method is used to set the Quartet value in JavaTuples and a copy with a new value at the specified index i.e. index 0 here.Let us first see what we need to work with JavaTuples. To work with Quartet class in JavaTuples, you need to import the following ... Read More

What is auto refresh feature in JSP?

Samual Sam

Samual Sam

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

203 Views

JSP makes this job easy by providing you a mechanism where you can make a webpage in such a way that it would refresh automatically after a given interval.The simplest way of refreshing a Webpage is by using the setIntHeader() method of the response object. Following is the signature of ... Read More

MonthDay get() method in Java

Samual Sam

Samual Sam

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

114 Views

The value of the specified field from the MonthDay can be obtained using the get() method in the MonthDay class in Java. This method requires a single parameter i.e. ChronoField that is required and it returns the value of the specified field from the MonthDay.A program that demonstrates this is ... Read More

Using Time datatype in MySQL without seconds?

Samual Sam

Samual Sam

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

2K+ Views

You need to use DATE_FORMAT() for this. The syntax is as follows −SELECT DATE_FORMAT(yourColumnName, '%k:%i') as anyAliasName FROM yourTableName;You can use ‘%H:%i’ for the same result. To understand the above syntax, let us create a table.The query to create a table is as follows −mysql> create table TimeDemo    -> ... Read More

Advertisements