To select only duplicate records from database and display the count, use HAVING along with aggregate function count(). Let us first create a table −mysql> create table duplicateRecords -> ( -> ClientId int NOT NULL AUTO_INCREMENT PRIMARY KEY, -> ClientName varchar(20) -> ); Query OK, 0 rows affected (0.49 sec)Following is the query to insert records in the table using insert command −mysql> insert into duplicateRecords(ClientName) values('John'); Query OK, 1 row affected (0.16 sec) mysql> insert into duplicateRecords(ClientName) values('Carol'); Query OK, 1 row affected (0.17 sec) mysql> insert into duplicateRecords(ClientName) values('John'); Query OK, 1 row affected ... Read More
To check if field exists and then to return the result set, you can use the below syntax −show columns from yourTableName where field='yourColumnName';Let us first create a table −mysql> create table DemoTable ( UserId int NOT NULL AUTO_INCREMENT PRIMARY KEY, UserFirstName varchar(20), UserLastName varchar(20), UserAge int, UserAddress varchar(200), UserCountryName varchar(20) ); Query OK, 0 rows affected (0.67 sec)Here is the query to check if field exists and then return the result set −mysql> show columns from DemoTable where field='UserCountryName';This will produce the following output −+-----------------+-------------+------+-----+---------+-------+ | Field | ... Read More
The 8085AH-2 always works with a clock period of 200nS. We start the calculations by assuming that the valid address, and IO/M* signals are sent by the 8085AH-2 time 0 nS. After that the, Arithmetic Logical Unit moves to state 0 at 50 nS (tAL), and RD* gets activated at 115 nS (tAC).Earliest data output time considering tAcc: Address ranging from A13 to A18 is received by 27128 from 8085 processor by means of the octal line driver 74LS244 at 12 ns of time. Address ranging from A7 to A0 is received by the 27128 from 8085 processor by means of 74LS373. So ... Read More
The ON UPDATE CURRENT_TIMESTAMP defines that an update without an explicit timestamp would result in an update to the current timestamp value.You can remove ON UPDATE CURRENT_TIMESTAMP from a column using ALTER command.The syntax is as followsALTER TABLE yourTableName CHANGE yourTimeStampColumnName yourTimeStampColumnName timestamp NOT NULL default CURRENT_TIMESTAMP;To understand the above syntax, let us create a table. The query to create a table is as followsmysql> create table removeOnUpdateCurrentTimeStampDemo - > ( - > Id int NOT NULL AUTO_INCREMENT PRIMARY KEY, - > Name varchar(20), - > UserUpdateTimestamp timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP ... Read More
This example demonstrate about How to get current Wi-Fi BSSID 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 WIFI ID.Step 3 − Add the following code to src/MainActivity.javapackage com.example.myapplication; import android.accounts.Account; import android.accounts.AccountManager; import android.app.ActivityManager; import android.bluetooth.BluetoothManager; import android.content.Context; import android.hardware.usb.UsbDevice; import android.hardware.usb.UsbManager; import android.net.ConnectivityManager; import android.net.Network; import android.net.wifi.WifiInfo; import android.net.wifi.WifiManager; import android.os.Build; import android.os.Bundle; import android.os.PowerManager; ... Read More
An immutable copy of a LocalDateTime with the day of year altered as required is done using the method withDayOfYear() in the LocalDateTime class in Java. This method requires a single parameter i.e. the day of year that is to be set in the LocalDateTime and it returns the LocalDateTime with the day of year altered as required.A program that demonstrates this is given as follows −Example Live Demoimport java.time.*; public class Main { public static void main(String[] args) { LocalDateTime ldt1 = LocalDateTime.parse("2019-02-18T23:15:30"); System.out.println("The LocalDateTime is: " + ldt1); LocalDateTime ... Read More
You can return a specific field from collection.find() by using the following syntax.Case 1 − The syntax is as follows −db.yourCollectionName.find({}, {"yourFieldName":1}).pretty();The above field name is set to 1 means it will return only that field. If you set to 0 it will return all fields except the field which is set to 0.Case 2 − The syntax is as follows −db.yourCollectionName.find({}, {"yourFieldName":0}).pretty();To understand the above syntaxes, let us create a collection with document. The query to create a collection with document is as follows −> db.returnFieldInFindDemo.insertOne({"StudentName":"John", "StudentAge":23, "TechnicalSubject":["MongoDB", "MySQL"]}); { "acknowledged" : true, "insertedId" : ObjectId("5c8ebfe72f684a30fbdfd566") } ... Read More
QueueThe queue which is implemented as FIFO where insertions are done at one end (rear) and deletions are done from another end (front). The first element that entered is deleted first.Queue operations are −EnQueue (int data) − Insertion at rear endint DeQueue()− Deletion from front endThis is a C++ program to implement queue using array.AlgorithmBegin function Enqueue() to insert elements in queue: If queue is completely filled up then print “Overflow”. Otherwise insert element at rear. Update the value of rear End Begin function Dequeue() to delete elements from ... Read More
This example demonstrate about How to make custom dialog with rounded corners 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 button. When user click on button, it will show custom dialog.Step 3 − Add the following code to src/MainActivity.javapackage com.example.andy.myapplication; import android.os.Build; import android.os.Bundle; import android.support.annotation.RequiresApi; import android.support.v7.app.AlertDialog; import android.support.v7.app.AppCompatActivity; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Button; public class MainActivity extends ... Read More
To compare timestamps in MySQL, you can use DATE(). Let us first create a table−mysql> create table comparingTimestampDemo -> ( -> Id int NOT NULL AUTO_INCREMENT PRIMARY KEY, -> AdmissionDate timestamp -> ); Query OK, 0 rows affected (0.54 sec)Following is the query to insert records in the table using insert command −mysql> insert into comparingTimestampDemo(AdmissionDate) values('2019-03-31'); Query OK, 1 row affected (0.13 sec) mysql> insert into comparingTimestampDemo(AdmissionDate) values('2019-04-10'); Query OK, 1 row affected (0.12 sec) mysql> insert into comparingTimestampDemo(AdmissionDate) values('2019-04-15'); Query OK, 1 row affected (0.17 sec) mysql> insert into comparingTimestampDemo(AdmissionDate) values('2019-03-29'); Query OK, 1 ... Read More