Karthikeya Boyini has Published 2383 Articles

How to check element is available in android ConcurrentLinkedDeque?

karthikeya Boyini

karthikeya Boyini

Updated on 30-Jun-2020 13:00:06

58 Views

Before getting into example, we should know what ConcurrentLinkedDequeis, it is unbounded deque based on linked nodes. Multiple threads can access deque elements with safety.This example demonstrate about How to check element is available in android ConcurrentLinkedDequeStep 1 − Create a new project in Android Studio, go to File ⇒ ... Read More

Inserting records into a MySQL table using PreparedStatement in Java?

karthikeya Boyini

karthikeya Boyini

Updated on 30-Jun-2020 12:58:22

4K+ Views

To insert a record in the table using PreparedStatement in Java, you need to use below syntax to insert records. The syntax is as follows −String anyVariableName= "INSERT INTO yourTableName(yourColumnName1, yourColumnName2, yourColumnName3, .........N)" + "VALUES (?, ?, ?, ..............N)";Now use the PreparedStatement object to set the value for all columns. ... Read More

How to add first element in android ConcurrentLinkedDeque?

karthikeya Boyini

karthikeya Boyini

Updated on 30-Jun-2020 12:58:00

63 Views

Before getting into example, we should know what ConcurrentLinkedDequeis, it is unbounded deque based on linked nodes. Multiple threads can access deque elements with safety.This example demonstrate about How to add first element in android ConcurrentLinkedDequeStep 1 − Create a new project in Android Studio, go to File ⇒ New ... Read More

How to find the minimum values of two or more fields in MySQL?

karthikeya Boyini

karthikeya Boyini

Updated on 30-Jun-2020 12:54:44

569 Views

To find the minimum values of two or more fields, use LEAST() function from MySQL −select least(yourColumnName1, yourColumnName2, ...N) from yourTableName;Let us first create a table −mysql> create table DemoTable -> ( -> Date1 date, -> Date2 date, -> Date3 date -> ); Query OK, 0 rows affected (0.54 sec)Insert ... Read More

MySQL query to split a column after specific characters?

karthikeya Boyini

karthikeya Boyini

Updated on 30-Jun-2020 12:53:12

794 Views

To split a column after specific characters, use the SUBSTRING_INDEX() method −select substring_index(yourColumnName, '-', -1) AS anyAliasName from yourTableName;Let us first create a table −mysql> create table DemoTable -> ( -> StreetName text -> ); Query OK, 0 rows affected (0.60 sec)Insert some records in the table using insert command ... Read More

Copy a few columns from a table to another in MySQL

karthikeya Boyini

karthikeya Boyini

Updated on 30-Jun-2020 12:52:17

286 Views

Let us first create a table −mysql> create table DemoTable1    -> (    -> Id int,   -> Name varchar(100)    -> ); Query OK, 0 rows affected (0.53 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1 values(10, 'John'); Query OK, 1 row affected ... Read More

Order by number of chars in MySQL?

karthikeya Boyini

karthikeya Boyini

Updated on 30-Jun-2020 12:46:58

346 Views

To order by number of chars, use ORDER BY and LENGTH() method. Following is the syntax −select *from yourTableName order by LENGTH(yourColumnName) DESC;Let us first create a table −mysql− create table DemoTable    -> (    -> Name varchar(100)    -> ); Query OK, 0 rows affected (0.50 sec)Insert some ... Read More

MySQL query to search between comma separated values within one field?

karthikeya Boyini

karthikeya Boyini

Updated on 30-Jun-2020 12:45:13

394 Views

Use FIND_IN_SET for this. Let us first create a table −mysql> create table DemoTable -> ( -> ListOfValues text -> ); Query OK, 0 rows affected (0.56 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values('10|20|30|40|50|60|100'); Query OK, 1 row affected (0.18 sec)Display all records ... Read More

How to correctly convert a date format into a MySQL date?

karthikeya Boyini

karthikeya Boyini

Updated on 30-Jun-2020 12:29:31

180 Views

Use the STR_TO_DATE() method for this. Let us first create a table −mysql> create table DemoTable -> ( -> DueDatetime varchar(100) -> ); Query OK, 0 rows affected (1.03 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values('22-06-2019 14:40'); Query OK, 1 row affected (0.20 ... Read More

How to set default Field Value in MySQL?

karthikeya Boyini

karthikeya Boyini

Updated on 30-Jun-2020 12:27:04

552 Views

To set default field value, use the “default”. Let us first create a table −mysql> create table DemoTable -> ( -> Age int -> ); Query OK, 0 rows affected (0.58 sec)Here is the query to set default field value in MySQL −mysql> alter table DemoTable MODIFY Age int default ... Read More

Advertisements