Arjun Thakur has Published 1176 Articles

Get table column names in alphabetical order in MySQL?

Arjun Thakur

Arjun Thakur

Updated on 30-Jun-2020 06:31:17

1K+ Views

To get the table column names in alphabetical order, you need to use ORDER BY. The syntax is as follows −SELECT anyReferenceName.COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS anyReferenceName WHERE anyReferenceName.TABLE_NAME = ’yourTableName’ ORDER BY anyReferenceName.COLUMN_NAMEFirst, we need to get all the columns and then we need to use ORDER BY. In the above ... Read More

How to ORDER BY LIKE in MySQL?

Arjun Thakur

Arjun Thakur

Updated on 30-Jun-2020 06:19:10

1K+ Views

To order by like in MySQL, use the case statement. The syntax is as follows −SELECT *FROM yourTableName    ORDER BY CASE    WHEN yourColumnName like '%yourPatternValue1%' then 1    WHEN yourColumnName like '%yourPatternValue2%' then 2 else 3 end;To understand the above syntax, let us create a table. The query ... Read More

Use Iterator to remove an element from a Collection in Java

Arjun Thakur

Arjun Thakur

Updated on 29-Jun-2020 13:54:59

16K+ Views

An element can be removed from a Collection using the Iterator method remove(). This method removes the current element in the Collection. If the remove() method is not preceded by the next() method, then the exception IllegalStateException is thrown.A program that demonstrates this is given as follows.Example Live Demoimport java.util.ArrayList; import ... Read More

Obtain the Previous Index and Next Index in an ArrayList using the ListIterator in Java

Arjun Thakur

Arjun Thakur

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

800 Views

The previous index and next index in an ArrayList can be obtained using the methods previousIndex() and nextIndex() respectively in the ListIterator Interface.The previousIndex() method returns the index of the element that is returned by the previous() method while the nextIndex() method returns the index of the element that is ... Read More

Get the unmodifiable view of the specified ArrayList in Java

Arjun Thakur

Arjun Thakur

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

351 Views

The unmodifiable view of the specified ArrayList can be obtained by using the method java.util.Collections.unmodifiableList(). This method has a single parameter i.e. the ArrayList and it returns the unmodifiable view of that ArrayList.A program that demonstrates this is given as followsExample Live Demoimport java.util.ArrayList; import java.util.ArrayList; import java.util.Collections; import java.util.List; public ... Read More

Check for the existence of a key in Java IdentityHashMap

Arjun Thakur

Arjun Thakur

Updated on 29-Jun-2020 13:20:52

71 Views

Use the containsKey() method to check whether a particular key exists in IdentityHashMap or not.Create a IdentityHashMapMap m = newIdentityHashMap(); m.put("1", 100); m.put("2", 200); m.put("3", 300); m.put("4", 150); m.put("5", 110); m.put("6", 50); m.put("7", 90); m.put("8", 250); m.put("9", 350); m.put("10", 450);Now, let’s say we need to check whether key 7 exists ... Read More

Fetch the value for a specific key in Java IdentityHashMap

Arjun Thakur

Arjun Thakur

Updated on 29-Jun-2020 13:10:08

1K+ Views

To fetch the value for a specific key, use the get() method.As a parameter, set the key you want to fetch and fetch the value.Let’s say you need to fetch value of key 3get("3")The following is an example to fetch the value for a specific key in Java IdentityHashMap −Example Live ... Read More

How to add a NOT NULL column in MySQL?

Arjun Thakur

Arjun Thakur

Updated on 29-Jun-2020 13:01:56

3K+ Views

You can add a not null column at the time of table creation or you can use it for an existing table.Case 1 − Add a not null column at the time of creating a table. The syntax is as followsCREATE TABLE yourTableName (    yourColumnName1 dataType NOT NULL,   ... Read More

How to read json array in reverse order in android?

Arjun Thakur

Arjun Thakur

Updated on 29-Jun-2020 12:02:52

373 Views

This example demonstrate about How to read json array in reverse order in android.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

Moving left animation with keyframes using CSS3

Arjun Thakur

Arjun Thakur

Updated on 29-Jun-2020 12:01:46

137 Views

You can try to run the following code to move left animation with keyframes using CSS3ExampleLive Demo                    h1 {             -moz-animation-duration: 3s;             -webkit-animation-duration: 3s;           ... Read More

Previous 1 ... 5 6 7 8 9 ... 118 Next
Advertisements