Anvi Jain has Published 634 Articles

How to get month information in android using yearmonth API class?

Anvi Jain

Anvi Jain

Updated on 29-Jun-2020 13:36:51

113 Views

This example demonstrate about How to get month information in android using yearmonth API class.Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.Step 2 − Add the following code to res/layout/activity_main.xml.   ... Read More

How to get local time and date in android using LocalDateTime API class?

Anvi Jain

Anvi Jain

Updated on 29-Jun-2020 13:35:36

589 Views

This example demonstrate about How to get local time and date in android using LocalDateTime API class.Step 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.Step 2 − Add the following code to res/layout/activity_main.xml. ... Read More

How to create a table with auto-increment column in MySQL using JDBC?

Anvi Jain

Anvi Jain

Updated on 29-Jun-2020 13:12:06

2K+ Views

While creating a table, in certain scenarios, we need values to column such as ID, to be generated/incremented automatically. Various databases support this feature in different ways.In MySQL database you can declare a column auto increment using the following syntax.CREATE TABLE table_name(    ID INT PRIMARY KEY AUTO_INCREMENT,    column_name1 ... Read More

Avoid placing password on command line with MySQL Utilities?

Anvi Jain

Anvi Jain

Updated on 29-Jun-2020 08:04:20

130 Views

First you need to reach the location of “my.cnf” with the help of below query for MySQL Utilities. The query is as follows −mysql> select @@datadir;The following is the output that display where “my.conf” is −+---------------------------------------------+ | @@datadir                         ... Read More

Tada Animation Effect with CSS

Anvi Jain

Anvi Jain

Updated on 29-Jun-2020 08:01:06

488 Views

To create Tada animation effect with CSS, you can try to run the following code:ExampleLive Demo                    .animated {             background-image: url(/css/images/logo.png);             background-repeat: no-repeat;             ... Read More

Simple way to toggle a value of an int field in MySQL

Anvi Jain

Anvi Jain

Updated on 29-Jun-2020 07:52:06

274 Views

To toggle a value of an int field, you can use update command with if(). The syntax is as follows −update yourTableName set yourColumnName = IF(yourColumnName = 0, 1, 0);To understand the above toggle syntax, create a table with some int value. The query to create a table is as ... Read More

How to reset the primary key of a table in mysql?

Anvi Jain

Anvi Jain

Updated on 29-Jun-2020 07:40:36

820 Views

The reset the primary key of a table means to reset the auto_increment property to 1. The syntax is as follows to reset the primary key of a table.alter table yourTableName auto_increment = 1;To understand, let us create a table −mysql> create table ResetPrimaryKey −> (    −> Id int ... Read More

How to get timestamp using MySQL?

Anvi Jain

Anvi Jain

Updated on 29-Jun-2020 07:32:46

146 Views

You can get timestamp with the help of current_timestamp, now() and current_timestamp().Case 1 − Using current_timestamp()The query is as follows −mysql> SELECT CURRENT_TIMESTAMP();The following is the output displaying timestamp −+---------------------+ | CURRENT_TIMESTAMP() | +---------------------+ | 2018-11-29 16:09:31 | +---------------------+ 1 row in set (0.00 sec)Case 2 − Using now()The query ... Read More

Get the number of columns in a MySQL table?

Anvi Jain

Anvi Jain

Updated on 29-Jun-2020 07:25:22

486 Views

To get the number of columns, use the aggregate function count(*) with information_schema table from MySQL. The syntax is as follows to find the number of columns −SELECT COUNT(*) as anyVariableName from INFORMATION_SCHEMA.COLUMNS where table_schema = ’yourDatabaseName’ and table_name = ’yourTableName’;To understand the above syntax, let us create a table ... Read More

Move rows from one table to another in MySQL?

Anvi Jain

Anvi Jain

Updated on 29-Jun-2020 07:23:06

3K+ Views

You can move rows from one table to another with the help of INSERT INTO SELECT statement.The syntax is as follows −insert into yourDestinationTableName select *from yourOriginalTable where someConditionTo understand the above syntax. let us create a table. The following is the query to create a table −mysql> create table ... Read More

Advertisements