What are the in-built functional interfaces in Java?

raja
Published on 13-Dec-2019 13:01:27
The java.util.function package defines several in-built functional interfaces that can be used when creating lambda expressions or method references.Inbuilt functional interfaces:1) Function InterfaceThe Function interface has only one single method apply(). It can accept an object of any data type and returns a result of any datatype.Exampleimport java.util.*; import java.util.function.*; ... Read More

MySQL insert a value to specific row and column

AmitDiwan
Published on 13-Dec-2019 11:19:30
Let us first create a table −mysql> create table DemoTable1569    -> (    -> StudentId varchar(10),    -> StudentName varchar(20)    -> ); Query OK, 0 rows affected (3.05 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1569 values('John_12', 'John Smith'); Query OK, 1 row ... Read More

Finding total number of rows of tables across multiple databases in MySQL?

AmitDiwan
Published on 13-Dec-2019 10:47:54
To fetch total number of table rows across databases, use aggregate function SUM() along with INFORMATION SCHEMA. Let us first create a table, which is in “web” database −mysql> create table DemoTable1568    -> (    -> Name varchar(20)    -> ); Query OK, 0 rows affected (0.61 sec)Insert some ... Read More

Getting the last 30 rows in MySQL

AmitDiwan
Published on 13-Dec-2019 10:45:49
To get the last 30 rows in MySQL, you need to use ORDER BY DESC and then LIMIT 30. The syntax is as follows −select * from yourTableName order by yourColumnName DESC LIMIT 30;Let us first create a table −mysql> create table DemoTable1567    -> (    -> Id int ... Read More

What are the constructor references in Java?

raja
Published on 13-Dec-2019 07:42:41
A constructor reference is just like a method reference except that the name of the method is "new". It can be created by using the "class name" and the keyword "new" with the following syntax.Syntax<Class-Name> :: newIn the below example, we are using java.util.function.Function. It is a functional interface whose single abstract method is ... Read More

Using CASE statement in MySQL to display custom name for empty value

AmitDiwan
Published on 13-Dec-2019 07:09:56
For this, you can use CASE WHEN statement. Let us first create a table −mysql> create table DemoTable    -> (    -> Name varchar(20)    -> ); Query OK, 0 rows affected (0.62 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values('Chris'); Query OK, ... Read More

Implement ORDER BY in MySQL to order records in human readable format?

AmitDiwan
Published on 13-Dec-2019 07:08:14
For this, use INET_ATON() in MySQL. Let’s say our records are in the form of an IP Address. The INET_ATON() method would allow a user to convert IP Address records to the number and then we can use ORDER BY to order them.Let us first create a table −mysql> create ... Read More

MySQL query to display custom text for empty columns

AmitDiwan
Published on 13-Dec-2019 07:06:24
Let us first create a table −mysql> create table DemoTable    -> (    -> FirstName varchar(20)    -> ); Query OK, 0 rows affected (0.77 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values('Chris'); Query OK, 1 row affected (0.14 sec) mysql> insert into ... Read More

Wrap around to first value and implement MySQL ORDER BY ASC and DESC in a single query

AmitDiwan
Published on 13-Dec-2019 07:04:30
Let us first create a table −mysql> create table DemoTable    -> (    -> Value int    -> ); Query OK, 0 rows affected (3.21 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values(20); Query OK, 1 row affected (0.78 sec) mysql> insert into ... Read More

Find second max in a table using MySQL query?

AmitDiwan
Published on 13-Dec-2019 07:02:38
You can use LIMIT 1 OFFSET 1. Let us first create a table −mysql> create table DemoTable    -> (    -> Value int    -> ); Query OK, 0 rows affected (0.92 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values(1); Query OK, 1 ... Read More
1 2 3 4 5 6 7 ... 2948 Next
Advertisements
25选5胆拖表