Karthikeya Boyini has Published 2550 Articles

Insert row with only default values in MySQL

karthikeya Boyini

karthikeya Boyini

Updated on 30-Jun-2020 15:03:29

2K+ Views

Use DEFAULT keyword at the time of table creation and it will insert default value whenever you do not provide the value for that column.Let us first create a table. Here, for ClientAge, we have set the default 24:Let us first create a table. Here, for ClientAge, we have set ... Read More

Increase database field value by specified percentage using user-defined variables in MySQL

karthikeya Boyini

karthikeya Boyini

Updated on 30-Jun-2020 15:01:18

266 Views

Let us first create a table −mysql> create table DemoTable -> ( -> Amount int -> ); Query OK, 0 rows affected (0.99 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values(100); Query OK, 1 row affected (0.23 sec) mysql> insert into DemoTable values(200); ... Read More

How to use peekLast() in android LinkedBlockingDeque?

karthikeya Boyini

karthikeya Boyini

Updated on 30-Jun-2020 14:59:22

55 Views

Before getting into an example, we should know what LinkedBlockingDeque is. It is implemented by Collection interface and the AbstractQueue class. It provides optional boundaries based on linked nodes.It going to pass memory size to a constructor and helps to provide memory wastage in android.This example demonstrates about How to ... Read More

How to use peekFirst() in android LinkedBlockingDeque?

karthikeya Boyini

karthikeya Boyini

Updated on 30-Jun-2020 14:58:20

55 Views

Before getting into an example, we should know what LinkedBlockingDeque is. It is implemented by Collection interface and the AbstractQueue class. It provides optional boundaries based on linked nodes. It going to pass memory size to a constructor and helps to provide memory wastage in android.This example demonstrates about How ... Read More

How to use peek() in android ConcurrentLinkedQueue?

karthikeya Boyini

karthikeya Boyini

Updated on 30-Jun-2020 14:57:28

73 Views

Before getting into an example, we should know what ConcurrentLinkedQueue is, it is an unbounded queue based on linked nodes. Multiple threads can access queue elements with safety. Elements travel based on queue strategy as FIFO and elements going to insert from a tail. It does not allow null values.This ... Read More

Find a specific column in all the tables in a database?

karthikeya Boyini

karthikeya Boyini

Updated on 30-Jun-2020 14:56:44

521 Views

For this, use COLUMN_NAME and set LIKE with that specific column name. Let us find a specific column in an unknown table in a database −mysql> SELECT TABLE_NAME, COLUMN_NAME, DATA_TYPE, IS_NULLABLE, COLUMN_DEFAULT    -> FROM INFORMATION_SCHEMA.COLUMNS    -> WHERE column_name LIKE '%StudentName%'    -> AND table_schema = 'web';OutputThis will produce ... Read More

How to use peek() in android ConcurrentLinkedDeque?

karthikeya Boyini

karthikeya Boyini

Updated on 30-Jun-2020 14:54:52

117 Views

Before getting into the example, we should know what ConcurrentLinkedDeque is, it is unbounded deque based on linked nodes. Multiple threads can access deque elements with safety.This example demonstrates about How to use peek() in android ConcurrentLinkedDequeStep 1 − Create a new project in Android Studio, go to File ⇒ ... Read More

Can we get records “Jone Deo” or “Deo Jone” with a single MySQL query?

karthikeya Boyini

karthikeya Boyini

Updated on 30-Jun-2020 14:52:43

53 Views

For this, you can use the LIKE clause. Let us first create a table −mysql> create table DemoTable    -> (    -> ClientName varchar(100)    -> ); Query OK, 0 rows affected (0.85 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values('John Smith'); Query ... Read More

How to add column and index in a single MySQL query?

karthikeya Boyini

karthikeya Boyini

Updated on 30-Jun-2020 14:51:51

3K+ Views

Use ALTER for this with ADD. Following is the syntax −alter table yourTableName add yourColumnName DATETIME DEFAULT NOW(), add index(yourColumnName);Let us first create a table −mysql> create table DemoTable    -> (    -> Id int NOT NULL AUTO_INCREMENT,    -> Name varchar(100),    -> PRIMARY KEY(Id)    -> ); ... Read More

MySQL query to first set negative value in descending order and then positive value in ascending order

karthikeya Boyini

karthikeya Boyini

Updated on 30-Jun-2020 14:45:28

380 Views

For this, you can use UNION. Let us first create a table −mysql> create table DemoTable -> ( -> Number int -> ); Query OK, 0 rows affected (1.17 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values(10); Query OK, 1 row affected (0.23 sec) ... Read More

Previous 1 ... 6 7 8 9 10 ... 255 Next
Advertisements