Select MySQL Rows Where Column Contains Same Data in More Than One Record

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

573 Views

Use MySQL JOIN to select MySQL rows where column contains same data in more than one record. Let us first create a table −mysql> create table DemoTable (    UserId int,    UserName varchar(20) ); Query OK, 0 rows affected (0.54 sec)Insert records in the table using insert command −mysql> insert into DemoTable values(10, 'John'); Query OK, 1 row affected (0.16 sec) mysql> insert into DemoTable values(11, 'Sam'); Query OK, 1 row affected (0.21 sec) mysql> insert into DemoTable values(12, 'Larry'); Query OK, 1 row affected (0.16 sec) mysql> insert into DemoTable values(13, 'David'); Query OK, 1 row affected (0.17 ... Read More

Asynchronous Transfer Mode (ATM)

Krantik Chavan
Updated on 30-Jul-2019 22:30:25

6K+ Views

Asynchronous Transfer Mode (ATM) is a switching technique that uses time division multiplexing (TDM) for data communications. It is a network technology that supports voice, video and data communications. ATM encodes data into small fixed − sized cells so that they are suitable for TDM and transmits them over physical medium.The functional reference model of ATM is illustrated as below −FeaturesATM technology provides dynamic bandwidth that is particularly suited for bursty traffic.All data are encoded into identical cells. Hence, data transmission is simple, uniform and predictable. Uniform packet size ensures that mixed traffic is handled efficiently.The size of an ATM ... Read More

Implement MySQL CASE with OR Condition

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

1K+ Views

Here is the syntax of MySQL CASE OR conditionSELECT yourColumnName1, .....N ,    CASE WHEN yourColumnName2=0 or yourColumnName2IS NULL THEN 'yourMessage1' ELSE 'yourMessage2' END AS yourAliasName FROM yourTableName;To understand the above syntax, let us create a table. The query to create a table is as followsmysql> create table ReservationSystems    - > (    - > Id int NOT NULL AUTO_INCREMENT PRIMARY KEY,    - > Name varchar(20),    - > isSeatConfirmed tinyint    - > ); Query OK, 0 rows affected (0.61 sec)Insert some records in the table using insert command.The query is as followsmysql> insert into ReservationSystems(Name, isSeatConfirmed) ... Read More

Get Current Bluetooth Name in Android

Nitya Raut
Updated on 30-Jul-2019 22:30:25

1K+ Views

This example demonstrate about How to get current Bluetooth name 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 text view to show Bluetooth name.Step 3 − Add the following code to src/MainActivity.javapackage com.example.myapplication; import android.bluetooth.BluetoothManager; import android.content.Context; import android.net.ConnectivityManager; import android.net.Network; import android.os.Build; import android.os.Bundle; import android.os.health.SystemHealthManager; import android.provider.Telephony; import android.support.annotation.RequiresApi; import android.support.v7.app.AppCompatActivity; import android.telephony.SmsManager; import android.view.View; import android.view.WindowManager; import android.widget.TextView; ... Read More

LocalDateTime toString Method in Java

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

1K+ Views

The string value of the LocalDateTime object can be obtained using the method toString() in the LocalDateTime class in Java. This method requires no parameters and it returns the string value of the LocalDateTime object.A program that demonstrates this is given as follows −Example Live Demoimport java.time.*; public class Demo {    public static void main(String[] args) {       LocalDateTime ldt = LocalDateTime.parse("2019-02-18T23:15:30");       System.out.println("The LocalDateTime is: " + ldt.toString());    } }OutputThe LocalDateTime is: 2019-02-18T23:15:30Now let us understand the above program.The string value of the LocalDateTime is obtained using the method toString() and then this value ... Read More

DoubleStream findFirst Method in Java

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

100 Views

The findFirst() method returns an OptionalDouble describing the first element of this stream. It returns an empty OptionalDouble if the stream is empty.The syntax is as followsOptionalDouble findFirst()Here, OptionalDouble is a container object which may or may not contain a double value.To use the DoubleStream class in Java, import the following packageimport java.util.stream.DoubleStream;First, create a DoubleStream with some elementsDoubleStream doubleStream = DoubleStream.of(15.6, 30.2, 50.5, 78.9, 80.4, 95.8);Now, get the first element of this stream using the findFirst() methodOptionalDouble res = doubleStream.findFirst();The following is an example to implement DoubleStream findFirst() method in JavaExample Live Demoimport java.util.*; import java.util.stream.DoubleStream; public class Demo { ... Read More

Case Insensitive Search in MongoDB

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

3K+ Views

You can restrict case insensitive search in MongoDB with the help of '$regex'. The syntax is as follows −db.yourCollectionName.find({"yourFieldName" : { '$regex':'^yourValue$'}});You can use another regex. The syntax is as follows −db.yourCollectionName.find({"Name" : { '$regex':/^yourValue$/i}});To understand the concept, let us create a collection with the document. The query to create a collection with a document is as follows −> db.caseInsesitiveDemo.insertOne({"Name":"John"}); {    "acknowledged" : true,    "insertedId" : ObjectId("5c8bd66293c80e3f23815e83") } > db.caseInsesitiveDemo.insertOne({"Name":"Johnson"}); {    "acknowledged" : true,    "insertedId" : ObjectId("5c8bd66693c80e3f23815e84") } > db.caseInsesitiveDemo.insertOne({"Name":"Johny"}); {    "acknowledged" : true,    "insertedId" : ObjectId("5c8bd66a93c80e3f23815e85") }Display all documents from a collection with ... Read More

Retrieve a Record from an Existing Table Using JDBC API

Vrundesha Joshi
Updated on 30-Jul-2019 22:30:25

980 Views

A. You can read/fetch the contents of a record in a table using the SELECT query. This will return data in the form of a result table and, these result tables are called result-sets.SyntaxSELECT column1, column2, columnN FROM table_name; Or, SELECT * FROM table_name;To retrieve the contents of a row of a table using JDBC API you need to:Register the driver: Register the driver class using the registerDriver() method of the DriverManager class. Pass the driver class name to it, as parameter.Establish a connection: Connect ot the database using the getConnection() method of the DriverManager class. Passing URL (String), username (String), password ... Read More

Use Fade In and Fade Out Animation in Java for Android

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

2K+ Views

Fade in and fade out animation works based on alpha animation class. This example demonstrate about How to use Fade In and Fade Out Android Animation in Java.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/login.xml.             In the above code, we have taken imageview and two button. FadeIn button will provide fade enter animation to image view and FadeOut button provide fade exit animation to imageview.Step 3 − ... Read More

Convert Unix Timestamp into Human Readable Format in MySQL

Nishtha Thakur
Updated on 30-Jul-2019 22:30:25

974 Views

To convert UNIX timestamp into a human-readable format, use the FROM_UNIXTIME() method.Let us first create a table −mysql> create table timeConversionDemo    -> (    -> dateTimeConversion bigint    -> ); Query OK, 0 rows affected (0.45 sec)Following is the query to insert records in the table using insert command −mysql> insert into timeConversionDemo values(1554316200); Query OK, 1 row affected (0.14 sec) mysql> insert into timeConversionDemo values(1546194600); Query OK, 1 row affected (0.22 sec) mysql> insert into timeConversionDemo values(1511548200 ); Query OK, 1 row affected (0.21 sec)Following is the query to display all records from the table using ... Read More

Advertisements