Ankith Reddy has Published 1070 Articles

MySQL query to select records with a particular date?

Ankith Reddy

Ankith Reddy

Updated on 25-Jun-2020 13:48:29

9K+ Views

You can use DATE() from MySQL to select records with a particular date. The syntax is as follows.SELECT *from yourTableName WHERE DATE(yourDateColumnName)=’anyDate’;To understand the above syntax, let us first create a table. The query to create a table is as follows.mysql> create table AllRecordsFromadate -> ( -> Id int, -> ... Read More

How to add columns at specific position in existing table in MySQL?

Ankith Reddy

Ankith Reddy

Updated on 25-Jun-2020 13:45:41

7K+ Views

To add columns at a specific position in existing table, use after command. The syntax is as follows −ALTER TABLE yourTableName ADD COLUMN yourColumnName data type AFTER yourExistingColumnName;To understand the above syntax, let us first create a table. The query to create a table is as follows.mysql> create table changeColumnPosition ... Read More

Iterate over lines from multiple input streams in Python

Ankith Reddy

Ankith Reddy

Updated on 25-Jun-2020 13:43:08

515 Views

Python’s built-in open() function opens one file in read/write mode and read/write operations on it. To perform processing on multiple files in a batch, one has to use fileinput module of Python’s standard library. This module provides a Fileinput class with functionality of iterating over files. The module also defines ... Read More

Animate CSS border-top-color property

Ankith Reddy

Ankith Reddy

Updated on 25-Jun-2020 13:37:36

83 Views

To implement animation on the border-top-color property with CSS, you can try to run the following codeExampleLive Demo                    table, th, td {             border: 2px solid black;          }     ... Read More

Using reflection to check array type and length in Java

Ankith Reddy

Ankith Reddy

Updated on 25-Jun-2020 13:27:34

1K+ Views

The array type can be checked using the java.lang.Class.getComponentType() method. This method returns the class that represents the component type of the array. The array length can be obtained in int form using the method java.lang.reflect.Array.getLength().A program that demonstrates this is given as follows −Example Live Demoimport java.lang.reflect.Array; public class Demo ... Read More

Change column-width property with CSS Animations

Ankith Reddy

Ankith Reddy

Updated on 25-Jun-2020 13:11:35

257 Views

To implement animation on a column-width property with CSS, you can try to run the following codeExampleLive Demo                    div {             width: 600px;             height: 300px;       ... Read More

Pollard’s Rho Algorithm for Prime Factorization in java

Ankith Reddy

Ankith Reddy

Updated on 25-Jun-2020 12:59:32

172 Views

It is an algorithm to perform factorization on given integers. Following is the program implementing the Rho Algorithm for Prime Factorization.ProgramLive Demopublic class PollardsRho {    int num = 65;    public int gcd(int a, int b) {       int gcd = 0;       for(int i = 1; i

How to do a count on a MySQL union query?

Ankith Reddy

Ankith Reddy

Updated on 25-Jun-2020 12:57:18

6K+ Views

To do a count on a union i.e. to get the count of the UNION result, use the below syntax −SELECT COUNT(*) FROM ( SELECT yourColumName1 from yourTableName1 UNION SELECT yourColumName1 from yourTableName2 ) anyVariableName;To understand the above syntax, let us create two tables with some records. The query to ... Read More

Compare two long arrays in a single line in Java

Ankith Reddy

Ankith Reddy

Updated on 25-Jun-2020 12:41:40

119 Views

Two long arrays can be compared in Java using the java.util.Arrays.equals() method. This method returns true if the arrays are equal and false otherwise. The two arrays are equal if they contain the same number of elements in the same order.A program that compares two long arrays using the Arrays.equals() ... Read More

Binomial Coefficient in java

Ankith Reddy

Ankith Reddy

Updated on 25-Jun-2020 12:41:38

3K+ Views

Binomial coefficient (c(n, r) or nCr) is calculated using the formula n!/r!*(n-r)!. Following is the Java program find out the binomial coefficient of given integers.Programimport java.util.Scanner; public class BinomialCoefficient {    public static long fact(int i) {       if(i

Advertisements