Articles on Trending Technologies

Technical articles with clear explanations and examples

How to get a value more than a particular value from varchar column in MySQL?

AmitDiwan
AmitDiwan
Updated on 24-Sep-2019 547 Views

Since the column wherein you want to get the value more than a particular value is VARCHAR, use the CAST() function. For example, to fetch the value more than 999 from a column with varchar values.Let us first create a table −mysql> create table DemoTable (    Value varchar(100) ); Query OK, 0 rows affected (1.02 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values('900'); Query OK, 1 row affected (0.49 sec) mysql> insert into DemoTable values('1090'); Query OK, 1 row affected (0.14 sec) mysql> insert into DemoTable values('860'); Query OK, 1 row affected (0.25 ...

Read More

MySQL query to check if a string contains a value (substring) within the same row?

AmitDiwan
AmitDiwan
Updated on 24-Sep-2019 1K+ Views

Since we need to match strings from the same row, use LIKE operator. Let us first create a table −mysql> create table DemoTable (    FirstName varchar(100),    FullName varchar(100) ); Query OK, 0 rows affected (0.53 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values('John', 'John Smith'); Query OK, 1 row affected (0.08 sec) mysql> insert into DemoTable values('David', 'John Miller'); Query OK, 1 row affected (0.14 sec) mysql> insert into DemoTable values('Bob', 'Sam Miller'); Query OK, 1 row affected (0.18 sec) mysql> insert into DemoTable values('Chris', 'Chris Brown'); Query OK, 1 row affected ...

Read More

HTML Screen width Property

AmitDiwan
AmitDiwan
Updated on 24-Sep-2019 384 Views

The HTML Screen width property returns the total width of the user’s screen.SyntaxFollowing is the syntax −screen.widthExampleLet us see an example of HTML Screen width Property −    body {       color: #000;       height: 100vh;       background-color: #FBAB7E;       background-image: linear-gradient(62deg, #FBAB7E 0%, #F7CE68 100%);       text-align: center;    }    .btn {       background: #db133a;       border: none;       height: 2rem;       border-radius: 2px;       width: 40%;       display: block;       color: ...

Read More

Stream.Builder build() in Java

AmitDiwan
AmitDiwan
Updated on 24-Sep-2019 1K+ Views

The build() method of the Stream.Builder class builds the stream, transitioning this builder to the built state. The syntax is as follows −Stream build()Following is an example to implement the build() method of the Stream.Builder class −Exampleimport java.util.stream.Stream; public class Demo {    public static void main(String[] args) {       Stream.Builder builder = Stream.builder();       builder.add("Production");       builder.add("Marketing");       builder.add("Finance");       builder.add("Sales");       builder.add("Operations");       Stream stream = builder.build();       stream.forEach(System.out::println);    } }OutputProduction Marketing Finance Sales OperationsExampleLet us see another example of build() ...

Read More

Calendar Functions in Java

AmitDiwan
AmitDiwan
Updated on 24-Sep-2019 1K+ Views

The java.util.calendar class provides the calendar functions in Java. Is an abstract class that provides methods for converting between a specific instant in time and a set of calendar fields such as YEAR, MONTH, DAY_OF_MONTH, HOUR, and so on, and for manipulating the calendar fields, such as getting the date of the next week.Following are the calendar functions in Java −Sr.NoMethod & Description1abstract void add(int field, int amount)This method adds or subtracts the specified amount of time to the given calendar field, based on the calendar's rules.2boolean after(Object when)This method returns whether this Calendar represents a time after the time ...

Read More

Ints toArray() function in Java

AmitDiwan
AmitDiwan
Updated on 24-Sep-2019 360 Views

The toArray() method of the Ints class returns an array containing each value of collection, converted to a int value in the manner of Number.intValue(). Following is the syntax −public static int[]    toArray(Collection

Read More

Ints max() function in Java

AmitDiwan
AmitDiwan
Updated on 24-Sep-2019 243 Views

The max() method of the Ints class returns the greatest value present in array. Following is the syntax −static int max(int... array)Let us first see an example −Exampleimport com.google.common.primitives.Ints; class Demo {    public static void main(String[] args) {       int[] myArr = { 10, 20, 30, 40, 50, 60, 20, 80, 20, 100 };       System.out.println(Ints.join("-", myArr));       System.out.println("Maximum value from the array = " + Ints.max(myArr));       // finding last index of element 20       int index = Ints.lastIndexOf(myArr, 20);       if (index != -1) { ...

Read More

Division Operators in Java

AmitDiwan
AmitDiwan
Updated on 24-Sep-2019 14K+ Views

The division operator in Java includes the Division, Modulus, and the Divide And Assignment operator. Let us work with them one by one −Divison OperatorThe division operator divides left-hand operand by right-hand operand.Modulus OperatorThe modulus operator divides left-hand operand by right-hand operand and returns remainder.Divide And Assignment OperatorThis operator divides left operand with the right operand and assign the result to left operand.Let us now see an example −Examplepublic class Demo {    public static void main( String args[] ) {       int a = 10;       int b = 20;       int c ...

Read More

Ints join() function in Java

AmitDiwan
AmitDiwan
Updated on 24-Sep-2019 378 Views

The join() method of Ints class returns a string containing the supplied int values separated by separator. The syntax is as follows −public static String    join(String separator, int[] arr)Here, separator parameter is something that should appear between consecutive values, whereas arr is an array of int values.Let us first see an example −Exampleimport com.google.common.primitives.Ints; class Demo {    public static void main(String[] args) {       int[] myArr = { 10, 20, 30, 40, 50, 60, 70, 80, 90, 100 };       System.out.println(Ints.join("-", myArr));       int index = Ints.indexOf(myArr, 40);       if ...

Read More

Ints indexOf() function in Java

AmitDiwan
AmitDiwan
Updated on 24-Sep-2019 1K+ Views

The indexOf() method of the Ints class returns the index of the first appearance of the value target in array. The syntax is as follows −public static int indexOf(int[] arr, int target)Here, parameter arr is an array of int values and target is the value to be checked for first appearance.Let us now see an example −Exampleimport com.google.common.primitives.Ints; class Demo {    public static void main(String[] args) {       int[] arr = { 10, 20, 30, 40, 50, 60, 70, 80, 90, 100 };       int index = Ints.indexOf(arr, 40);       if (index != ...

Read More
Showing 57311–57320 of 61,297 articles
Advertisements