To select data where a field has min value, you can use aggregate function min(). The syntax is as follows.SELECT *FROM yourTableName WHERE yourColumnName=(SELECT MIN(yourColumnName) FROM yourTableName);To understand the above syntax, let us create a table. The query to create a table is as follows.mysql> create table MinValueDemo -> ( -> ProductId int, -> ProductName varchar(100), -> ProductPrice int -> ); Query OK, 0 rows affected (0.77 sec)Insert some records in the table using insert command. The query is as follows.mysql> insert into MinValueDemo values(1, 'product-1', 4500); Query OK, 1 row affected (0.14 sec) mysql> insert into MinValueDemo values(2, ... Read More
Digital Marketing is the present day career on a boom. It is a way of advertising that provides many ways of online platforms for your product or service, unlike the traditional ways of advertising.To get established yourself as a digital marketing expert, it is always better to get certified. Google AdWords Certification and HubSpot Inbound Certification are the ones which are available for free. You can even try applying them again if you fail to succeed in your initial attempts.Preparing for the HubSpot Inbound Certification enables you to optimize your website and content, helps in making customers as brand promoters ... Read More
You can use SELECT IF statement with OR. To understand select with OR, let us create a table. The query to create a table is as follows −mysql> create table EmployeeInformation -> ( -> EmployeeId int, -> EmployeeName varchar(100), -> EmployeeStatus varchar(100) -> ); Query OK, 0 rows affected (0.68 sec)Insert some records in the table using insert command. The query is as follows −mysql> insert into EmployeeInformation values(1, 'Sam', 'FullTime'); Query OK, 1 row affected (0.23 sec) mysql> insert into EmployeeInformation values(2, 'Mike', 'PartTime'); Query OK, 1 row affected (0.14 sec) mysql> ... Read More
GSON is java library, It is used to convert OBJECT to JSON and JSON to Object. Internally it going to work based on serialization and de- serialization.This example demonstrate about how to convert ArrayList to string using GSON library.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 in build.gradle.apply plugin: 'com.android.application' android { compileSdkVersion 28 defaultConfig { applicationId "com.example.andy.myapplication" minSdkVersion 15 targetSdkVersion 28 ... Read More
In this program we will see how to search an element in an array of bytes using 8085.Problem StatementWrite 8085 Assembly language program to search a key value in an array of data using linear search technique.DiscussionIn this program the data are stored at location 8002H to 8007H. The 8000H is containing the size of the block, and 8001H is holding the key value to search. After executing this program, it will return the address of the data where the item is found and store the address at location 9000H and9001H. If the item is not found, it will return ... Read More
Sometimes we need to display more time then LENGTH_LONG. This example demonstrates how to show toast longer than Toast.LENGTH_LONG.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 a user clicks on text view, it will show toast for 1000 ms.Step 3 - Add the following code to src/MainActivity.javapackage com.example.andy.myapplication; import android.os.Build; import android.os.Bundle; import android.os.Handler; import android.support.annotation.RequiresApi; import android.support.v7.app.AppCompatActivity; import android.view.Gravity; ... Read More
You can create user if it does not exist with the help of “create user” command. The command will work on MySQL version 5.7.6 and above. The syntax is as follows −mysql> CREATE USER IF NOT EXISTS 'yourUserName'@'localhost' IDENTIFIED BY 'yourPassword';Apply the above syntax to create a user if it does not exist. The query is as follows −mysql> CREATE USER IF NOT EXISTS 'Smith'@'localhost' IDENTIFIED BY 'Smith123456'; Query OK, 0 rows affected (0.29 sec)To check the new user is created or not, use the below query −mysql> SELECT User FROM mysql.user;The following is the output −+------------------+ | User ... Read More
You can achieve this with the help of INFORMATION_SCHEMA.TABLES. Use the date_sub() with interval. The syntax is as follows −SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE DATE_SUB(NOW(), INTERVAL -1HOUR) < ‘UPDATE_TIME’;Now you can check the above syntax. Here is the query to find the tables modified in the last hour −mysql> select table_name from `INFORMATION_SCHEMA`.`TABLES` -> WHERE -> DATE_SUB(NOW(), INTERVAL 1 HOUR) < `UPDATE_TIME`;Output+---------------------+ | TABLE_NAME | +---------------------+ | innodb_table_stats | | innodb_index_stats | | employeeinformation | +---------------------+ 3 rows in set (0.37 sec)The above query selects only table name. If you want information like table schema, table ... Read More
Use the isEmpty() method to check of a HashMap is empty or not. Let us first create the HashMap −HashMap hm = new HashMap();Now, add some elements −hm.put("Bag", new Integer(1100)); hm.put("Wallet", new Integer(700)); hm.put("Belt", new Integer(600));Since, we added elements above, therefore, the HashMap isn’t empty. Let us check −set.isEmpty()The following is an example to check if a HashMap is empty or not −Example Live Demoimport java.util.*; public class Demo { public static void main(String args[]) { // Create a hash map HashMap hm = new HashMap(); ... Read More
An earthquake is defined as the sudden shaking of the Earth's surface. Earthquakes are caused by the collision of tectonic plates in the Earth's crust. These plates ride over each other when instability is created in the crust due to the release of energy from the Earth's core.There are large earthquakes and small earthquakes. Earthquakes are measured using an instrument called Seismometer. The magnitude of an earthquake is represented on the Richter scale. On the scale, 3 or less is scarcely noticeable, and magnitude 7 or more causes damage over a wide area.The Great Chilean earthquake also known as the ... Read More