Karthikeya Boyini has Published 2192 Articles

Sum if all rows are not null else return null in MySQL?

karthikeya Boyini

karthikeya Boyini

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

611 Views

You can achieve this with the help of GROUP BY HAVING clause. The syntax is as follows −SELECT yourColumnName1,    SUM(yourCoumnName2)    from yourTableName    GROUP BY yourColumnName1 HAVING COUNT(yourCoumnName2) = COUNT(*);To understand the above syntax, let us create a table. The query to create a table is as follows ... Read More

How to parse an XML in JSP?

karthikeya Boyini

karthikeya Boyini

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

982 Views

The tag is used to parse the XML data specified either via an attribute or in the tag body.AttributeThe tag has the following attributes −AttributeDescriptionRequiredDefaultvarA variable that contains the parsed XML dataNoNonexmlText of the document to parse (String or Reader)NoBodysystemIdThe system identifier URI for parsing the documentNoNonefilterThe filter ... Read More

What is import attribute in JSP?

karthikeya Boyini

karthikeya Boyini

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

2K+ Views

The import attribute serves the same function as and behaves like, the Java import statement. The value for the import option is the name of the package you want to import.To import java.sql.*, use the following page directive −To import multiple packages, you can specify them separated by comma as ... Read More

SecureRandom setSeed() method in Java

karthikeya Boyini

karthikeya Boyini

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

466 Views

The random object can be reseeded using the setSeed() method in the class java.security.SecureRandom. This method requires a single parameter i.e. the required seed byte array and it returns the reseeded random object.A program that demonstrates this is given as follows −Example Live Demoimport java.security.*; import java.util.*; public class Demo { ... Read More

MySQL “order by” inside of “group by”? Is it possible?

karthikeya Boyini

karthikeya Boyini

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

828 Views

Instead of using ORDER BY inside GROUP BY, you can use the MAX() aggregate function.The syntax is as follows −SELECT yourNameColumnName, MAX(yourRankColumnName) FROM yourTableName GROUP BY yourNameColumnName;To understand the above syntax, let us create a table. The query to create a table is as follows −mysql> create table MaxDemo   ... Read More

IntBuffer hasArray() method in Java

karthikeya Boyini

karthikeya Boyini

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

130 Views

It can be checked if a buffer has the backing of an accessible int array by using the method hasArray() in the class java.nio.IntBuffer. This method returns true if the buffer has the backing of an accessible int array and false otherwise.A program that demonstrates this is given as follows ... Read More

What is isThreadSafe attribute in JSP?

karthikeya Boyini

karthikeya Boyini

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

2K+ Views

The isThreadSafe option marks a page as being thread-safe. By default, all JSPs are considered thread-safe. If you set the isThreadSafe option to false, the JSP engine makes sure that only one thread at a time is executing your JSP.The following page directive sets the isThreadSafe option to false −Read More

MySQL select accumulated (running sum) column?

karthikeya Boyini

karthikeya Boyini

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

274 Views

To select accumulated column, let us first create a demo table. The query to create a table is as follows −mysql> create table accumulatedDemo    -> (    -> Value int    -> ); Query OK, 0 rows affected (0.58 sec)Insert some records in the table using insert command. The ... Read More

Display the warning message when a FLOAT value is inserted into DECIMAL in MySQL?

karthikeya Boyini

karthikeya Boyini

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

176 Views

You can create a temporary table with data type DECIMAL to get a warning when a float value is inserted into an int column. Display the same warning using SHOW WARNINGS.Let us create a table to understand. The query is as follows to create a table.mysql> create temporary table WarningDemo ... Read More

What is session attribute in JSP?

karthikeya Boyini

karthikeya Boyini

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

2K+ Views

The session attribute indicates whether or not the JSP page uses HTTP sessions. A value of true means that the JSP page has access to a builtin session object and a value of false means that the JSP page cannot access the builtin session object.Following directive allows the JSP page ... Read More

Advertisements