Count Rows with Same Value in MySQL

Anvi Jain
Updated on 30-Jul-2019 22:30:24

3K+ Views

To count how many rows have the same value using the function COUNT(*) and GROUP BY. The syntax is as follows −SELECT yourColumName1, count(*) as anyVariableName from yourTableName GROUP BY yourColumName1;To understand the above syntax, let us first create a table. The query to create a table is as follows −mysql> create table RowWithSameValue    −> (    −> StudentId int,    −> StudentName varchar(100),    −> StudentMarks int    −> ); Query OK, 0 rows affected (0.55 sec)Insert some records with same value. Here, we have added same marks for more than one student for our example. The query ... Read More

Check Whether Two HashSet are Equal in Java

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

440 Views

At first, create the first HashSet and add elements to it −// create hash set 1 HashSet hs1 = new HashSet(); hs1.add("G"); hs1.add("H"); hs1.add("I"); hs1.add("J"); hs1.add("K");Create the second HashSet and add elements to it −// create hash set 2 HashSet hs2 = new HashSet(); hs2.add("G"); hs2.add("H"); hs2.add("I"); hs2.add("J"); hs2.add("K");To check whether both the HashSet are equal or not, use the equals() method −hs1.equals(hs2)The following is an example to check whether two HashSet are equal −Example Live Demoimport java.util.*; public class Demo { public static void main(String args[]) { // create hash set ... Read More

Change Position of Toast in Android

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

2K+ Views

Before getting into an example, we should know what is toast in android. Toast is subclass for  java.lang.Object and used to show a short message for a short period of time after that is going to disappear.This example demonstrates how to change the position of Toast 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.     In the above code, we have taken a text view. when the user clicks on text ... Read More

What is an Adjective Clause in English Grammar

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

664 Views

An adjective clause is a clause which performs the function of an adjective in a sentence. The adjective is a word which modifies a noun or pronoun in a sentence. For example, a tall man, (where tall is an adjective) etc.The adjective clause may be introduced by a relative pronoun (whom, which, that, who etc) or relative adverb (where, when, after, before etc).Examples of the Adjective ClauseRam, who is the monitor of our class, is intelligent.She is the neighbor, whose dog is Ill-behaved.Give me a reason why should I believe you.Here, 'who is the monitor of the class' in the ... Read More

Latest Apple Products

yashwanth sitamraju
Updated on 30-Jul-2019 22:30:24

193 Views

Here are some of the latest Apple products unveiled at Worldwide Developers Conference (WWDC) in June 2017.iMac ProApple introduced a brand new model for existing iMac which is focused on offering strong performances.All new iMac pro comes out with a 27-inch screen with 5K display and space gray finish.Now, the iMac will feature Intel Xenon processors with 8, 10 and 18 core options. It also comes with 128GB memory and one TB of storage space. It has 3 USB-c ports and includes new Radeon Vega graphics. It will be priced around 5000USD.iMacApple also announces upgrades for existing iMac systems. All ... Read More

Create NavigableMap in Java

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

151 Views

Let us first create a NavigableMapNavigableMap n = new TreeMap();Now, let us add some elementsn.put("A", 888); n.put("B", 999); n.put("C", 444); n.put("D", 555); n.put("E", 666); n.put("F", 888);The following is the complete example to create NavigableMap, add elements and display themExample Live Demoimport java.util.*; public class Demo { public static void main(String[] args) { NavigableMap n = new TreeMap(); n.put("A", 888); n.put("B", 999); n.put("C", 444); ... Read More

Search for a String Within Text Column in MySQL

Jennifer Nicholas
Updated on 30-Jul-2019 22:30:24

1K+ Views

You can search for a string within text column in MySQL with the help of LIKE clause. The syntax is as follows −select *from yourTableName where yourColumnName like '%anyStringValue%';To use the above syntax, let us first create a table −mysql> create table SearchTextDemo    −> (    −> BookName TEXT    −> ); Query OK, 0 rows affected (0.55 sec)Insert some strings in the table. The query is as follows −mysql> insert into SearchTextDemo values('Let us C'); Query OK, 1 row affected (0.28 sec) mysql> insert into SearchTextDemo values('C in Depth'); Query OK, 1 row affected (0.14 sec) ... Read More

What is a Yagi-Uda Antenna and Its Design Specifications

Knowledge base
Updated on 30-Jul-2019 22:30:24

643 Views

Yagi-Uda antenna is the most commonly used type of antenna for TV reception over the last few decades. It is the most popular and easy-to-use type of antenna with better performance, which is famous for its high gain and directivity. The frequency range in which the Yagi-Uda antennas operate is around 30 MHz to 3 GHz which belong to the VHF and UHF bands.Construction of Yagi-Uda AntennaA Yagi-Uda antenna was seen on top of almost every house during the 90's when we had only Doordarshan Channels. The parasitic elements and the dipole together form this Yagi-Uda antenna. It is seen ... Read More

Change Column Position of MySQL Table Without Losing Data

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

11K+ Views

You can change the column position of MySQL table without losing data with the help of ALTER TABLE command. The syntax is as follows −ALTER TABLE yourTableName MODIFY yourColumnName1 data type AFTER yourColumnName2;To understand the above concept, let us create a table. The query to create a table with some columns is as follows −mysql> create table changeColumnPositionDemo −> ( −> StudentId int, −> StudentAddress varchar(200), −> StudentAge int, −> StudentName varchar(200) −> ); Query OK, 0 rows affected (0.72 sec)Let us insert some data in the table. The query to insert records is as follows -.mysql> insert into changeColumnPositionDemo ... Read More

Clone an ArrayList in Java

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

453 Views

An ArrayList can be cloned using the java.util.ArrayList.clone() method. This method does not take any parameters but returns a shallow copy the specified ArrayList instance. This means that the new ArrayList created using the ArrayList.clone() method refers to the same elements as the original ArrayList but it does not duplicate the elements.A program that demonstrates this is given as follows −Example Live Demoimport java.util.ArrayList; import java.util.List; public class Demo { public static void main(String[] args) { List aList1 = new ArrayList(); aList1.add("Apple"); ... Read More

Advertisements