MySQL DATE_FORMAT 'm' for Short Month

Arjun Thakur
Updated on 30-Jul-2019 22:30:24

124 Views

The %M Date Format is not used for displaying short months like Jan for January, Feb for February, etc. You need to use DATE_FORMAT() function with %b format for short month. The syntax is as follows:SELECT DATE_FORMAT(yourColumnName, '%d-%b-%y') AS anyVariableName FROM yourTableName;To understand the above syntax, let us create a table. The query to create a table is as follows:mysql> create table DateFormatMonthDemo    -> (    -> Id int NOT NULL AUTO_INCREMENT,    -> ShippingDate date,    -> PRIMARY KEY(Id)    -> ); Query OK, 0 rows affected (0.63 sec)Insert some records in the table using insert command. The ... Read More

Insert Data into MySQL Database with Java

Arjun Thakur
Updated on 30-Jul-2019 22:30:24

15K+ Views

To insert data into MySQL database, use INSERT command. The syntax is as follows −INSERT INTO yourTableName(yourColumnName1, ........yourColumnNameN)values(Value1, Value2, ......ValueN);Here, I am inserting records in a MySQL database with JAVA programming language. First, we need to create a table in MySQL. The query is as follows −mysql> create table InsertDemo    -> (    -> Id int,    -> Name varchar(200),    -> Age int    -> ); Query OK, 0 rows affected (0.97 sec)Now, here is the JAVA code to insert records into MySQL database with table InsertDemo. . Before that, we will establish a Java Connection to our ... Read More

NavigableSet Class Floor Method in Java

karthikeya Boyini
Updated on 30-Jul-2019 22:30:24

157 Views

The floor() method returns the greatest element less than or equal to the given element i.e. 30 here −floor(30)The following is an example to implement the floor method in Java −Example Live Demoimport java.util.NavigableSet; import java.util.TreeSet; public class Demo { public static void main(String[] args) { NavigableSet set = new TreeSet(); set.add(10); set.add(25); set.add(40); set.add(55); set.add(70); set.add(85); set.add(100); System.out.println("Returned Value = " + set.floor(30)); } }OutputReturned Value = 25

What Are Scavengers

Ridhi Arora
Updated on 30-Jul-2019 22:30:24

1K+ Views

Scavengers are also known as decomposers. They feed on the dead bodies and thus those who are dependent on decaying smelly matter. Some of the popular examples of decomposers are vultures, crows, hyenas, etc. It is a common myth that these scavengers are only carnivorous. They are even herbivores.Scavengers As Animal or BirdScavengers of dead plant material include termites that build nests in grasslands and then collect dead plant material for consumption within their accommodation i.e. the nest.Coprovores: Animals which consume feces, such as dung beetles are known as Coprovores.Detritivores: Animals that collect small particles of a dead animal or a ... Read More

Get Higher Key from NavigableMap in Java

karthikeya Boyini
Updated on 30-Jul-2019 22:30:24

135 Views

Getting higher key means to return the least key strictly greater than the given key. This is done using higherKey() method in Java.The following is an example.Example Live Demoimport java.util.*; public class Demo { public static void main(String[] args) { NavigableMap n = new TreeMap(); n.put(5, "Tom"); n.put(9, "John"); n.put(14, "Jamie"); n.put(1, "Tim"); n.put(4, "Jackie"); n.put(15, "Kurt"); n.put(19, "Tiger"); n.put(24, "Jacob"); System.out.println("NavigableMap elements..."+n); System.out.println("Higher Key = "+n.higherKey(15)); } }OutputNavigableMap elements... {1=Tim, 4=Jackie, 5=Tom, 9=John, 14=Jamie, 15=Kurt, 19=Tiger, 24=Jacob} Higher Key = 19

Reference Static Field After Declaration in Java

Rishi Raj
Updated on 30-Jul-2019 22:30:24

261 Views

The static field variable is a class level variable and it belongs to the class not the class object.So the static field variable is common to all the class objects i.e. a single copy of the static field variable is shared among all the class objects.A program that demonstrates referencing the static field variable after declaration is given as follows:Example Live Demopublic class Demo {    static int a = 7;    static int b = a + 5;    public static void main(String[] args) {       System.out.println("a = " + a);       System.out.println("b = " + ... Read More

Why We Use WHERE 1=0 in MySQL

George John
Updated on 30-Jul-2019 22:30:24

4K+ Views

The condition 1=0 can be used to stop the query from returning any rows. It returns empty set.The syntax is as follows:SELECT *FROM yourTableName WHERE 1=0;To understand the above syntax, let us create a table. The query to create a table is as follows:mysql> create table ConditionDemo    -> (    -> Id int NOT NULL AUTO_INCREMENT,    -> Name varchar(10),    -> PRIMARY KEY(Id)    -> ); Query OK, 0 rows affected (0.59 sec)Insert some records in the table using insert command. The query is as follows:mysql> insert into ConditionDemo(Name) values('Larry'); Query OK, 1 row affected (0.10 sec) mysql> ... Read More

NavigableSet Class Higher Method in Java

Samual Sam
Updated on 30-Jul-2019 22:30:24

121 Views

The higher() method in NavigableSet returns the least element strictly greater than the given element i.e. 35 here −higher(35);The following is an example to implement the higher method in Java −Example Live Demoimport java.util.NavigableSet; import java.util.TreeSet; public class Demo { public static void main(String[] args) { NavigableSet set = new TreeSet(); set.add(10); set.add(25); set.add(40); set.add(55); set.add(70); set.add(85); set.add(100); System.out.println("Returned Value = " + set.higher(35)); } }OutputReturned Value = 40

Sort HashMap Based on Keys in Java

karthikeya Boyini
Updated on 30-Jul-2019 22:30:24

273 Views

Firstly, create a HashMap −HashMap hm = new HashMap();Add some elements to the HashMap −hm.put("Shirts", new Integer(700)); hm.put("Trousers", new Integer(600)); hm.put("Jeans", new Integer(1200)); hm.put("Android TV", new Integer(450)); hm.put("Air Purifiers", new Integer(300)); hm.put("Food Processors", new Integer(950));Now, sort the HashMap based on keys using TreeMap −Map sort = new TreeMap(hm); System.out.println("Sorted Map based on key = "+sort);The following is an example to sort HasMap based on keys −Example Live Demoimport java.util.*; public class Demo { public static void main(String args[]) { HashMap hm = new HashMap(); hm.put("Shirts", new ... Read More

What is WAN Accelerator

Ankith Reddy
Updated on 30-Jul-2019 22:30:24

588 Views

A wide area network accelerator (WAN accelerator) is a hardware component, a software, or an appliance executing in a virtualized environment that provides caching and optimization of WAN services. A WAN accelerator is also called a WAN optimizer or application accelerator.Working PrincipleA WAN accelerator provides services to speed up information flow between the end users for imparting better network experience. Its target is to reduce the data volume to be transmitted. So, it compresses data and uses data deduplication techniques. The accelerator caches duplicate data and sends references of them when they are needed multiple times instead of resending the ... Read More

Advertisements