Select All Duplicate MySQL Rows Based on One or Two Columns

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

559 Views

For this, use subquery along with HAVING clause. Let us first create a table −mysql> create table DemoTable    (    StudentId int NOT NULL AUTO_INCREMENT PRIMARY KEY,    StudentFirstName varchar(20),    StudentLastName varchar(20)    ); Query OK, 0 rows affected (0.27 sec)Insert some records in the table using insert command −mysql> insert into DemoTable(StudentFirstName, StudentLastName) values('John', 'Smith'); Query OK, 1 row affected (0.04 sec) mysql> insert into DemoTable(StudentFirstName, StudentLastName) values('Carol', 'Taylor'); Query OK, 1 row affected (0.04 sec) mysql> insert into DemoTable(StudentFirstName, StudentLastName) values('John', 'Doe'); Query OK, 1 row affected (0.17 sec) mysql> insert into DemoTable(StudentFirstName, ... Read More

Find Sum of Digits of 8-Bit Number in 8086

Chandu yadav
Updated on 30-Jul-2019 22:30:26

2K+ Views

In this program we will see how to add the digits of an 8-bit number.Problem StatementWrite 8086 Assembly language program to add the digits of an 8-bit number stored in memory address 2000H.DiscussionTo get the digits of an 8-bit number, we can use the masking operation. At first we will mask the upper nibble, and then the lower nibble. After masking the upper nibble, we have to rotate it to the right to make it least significant nibble. Then we can simply add it to the stored nibble to get the sum.InputAddressData……20008A…… Flow Diagram ProgramOutputAddressData……200112……      

8085 Program to Subtract Two BCD Numbers

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

4K+ Views

Here we will see how to perform BCD subtractions using 8085.Problem StatementWrite 8085 Assembly language program to perform BCD subtractions of tow numbers stored at location 8001 and 8002. The result will be stored at 8050 and 8051.DiscussionTo subtract two BCD numbers, we are going to use the 10s complement method. Taking the first number and storing into B, Load 99 into A then subtract the number to get the 9’s complement. After that add 1 with the result to get 10’s complement. We cannot increase using INR instruction. This does not effect on CY flag. So we have to ... Read More

HTML DOM Anchor Download Property

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

152 Views

The HTML DOM download property is used to set or return the value of the download attribute of a link.Following is the syntax to set the download property −anchorObject.download = fileAbove, file represents the file name you can set for the file to be downloaded. The actual extension will get suffixed.Following is the syntax to return the download property: anchorObject.downloadLet us now see an example to implement the DOM Anchor download property −Example Live Demo ReactJS Display the value    function display() {       var val = document.getElementById("myid").download;    document.getElementById("demo").innerHTML = val;   ... Read More

Set Numbers as Varchar Field and Compare in MySQL

Rama Giri
Updated on 30-Jul-2019 22:30:26

231 Views

Let us first create a table −mysql> create table DemoTable    -> (    -> StudentId int NOT NULL AUTO_INCREMENT PRIMARY KEY,    -> StudentScore varchar(100)    -> ); Query OK, 0 rows affected (0.66 sec)Insert some records in the table using insert command −mysql> insert into DemoTable(StudentScore) values('90'); Query OK, 1 row affected (0.21 sec) mysql> insert into DemoTable(StudentScore) values('100'); Query OK, 1 row affected (0.13 sec) mysql> insert into DemoTable(StudentScore) values('56'); Query OK, 1 row affected (0.10 sec) mysql> insert into DemoTable(StudentScore) values('98'); Query OK, 1 row affected (0.13 sec)Display all records from the table ... Read More

HTML DOM Input Date StepDown Method

AmitDiwan
Updated on 30-Jul-2019 22:30:26

114 Views

The HTML DOM Input Date stepdown() method defines the amount of days the date field should decrease.SyntaxFollowing is the syntax −Calling stepDown method with a number, which by default is equal to 1inputDateObject.stepDown(number)ExampleLet us see an example of Input Date stepDown method − Live Demo Input Date stepDown() Calendar: Decrease by 2 Decrease by 3    var divDisplay = document.getElementById("divDisplay");    var inputDate = document.getElementById("dateSelect");    function changeStep(num){       if(num===2)          inputDate.stepDown(2);       else          inputDate.stepDown(3);       divDisplay.textContent = 'Current date decreased by: '+num;    } OutputThis will produce the following output −Clicking ‘Decrease by 2’ button −Clicking ‘Decrease by 3’ button −

HTML DOM ins Cite Property

AmitDiwan
Updated on 30-Jul-2019 22:30:26

164 Views

The HTML DOM ins cite property returns the URL of a document that reasons why text was inserted.SyntaxFollowing is the syntax −Returning string valueinsObject.citeExampleLet us see an example for ins cite property − Live Demo ins cite    form {       width:70%;       margin: 0 auto;       text-align: center;    }    * {       padding: 2px;       margin:5px;    }    input[type="button"] {       border-radius: 10px;    } ins-cite Fact: Water cannot persist on moon's surface.Water ice found on moon ... Read More

Count Distinct Column in MySQL

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

220 Views

You need to use GROUP BY for this. Let us first create a table −mysql> create table DemoTable    (    StudentFirstName varchar(20)    ); Query OK, 0 rows affected (0.74 sec)Insert records in the table using insert command −mysql> insert into DemoTable values('John'); Query OK, 1 row affected (1.34 sec) mysql> insert into DemoTable values('Carol'); Query OK, 1 row affected (0.28 sec) mysql> insert into DemoTable values('John'); Query OK, 1 row affected (0.14 sec) mysql> insert into DemoTable values('John'); Query OK, 1 row affected (0.14 sec) mysql> insert into DemoTable values('Bob'); Query OK, 1 row affected (0.25 sec) mysql> ... Read More

Get Max Connections Using DatabaseMetaData in Java

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

356 Views

The getMaxConnections() method of the DatabaseMetaData interface is used to find out the maximum number of connections that the underlying database allows at a time.This method returns an integer value, representing the maximum number of connections allowed at a time. If this value is 0 it indicates that there is no limit or, limit is unknown.To get the DatabaseMetaData object −Make sure your database is up and running.Register the driver using the registerDriver() method of the DriverManager class. Pass an object of the driver class corresponding to the underlying database.Get the connection object using the getConnection() method of the DriverManager class. ... Read More

Counting Presence of a Not Null Value in MySQL

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

718 Views

To count presence of a NOT NULL value, use aggregate function COUNT(yourColumnName). Let us first create a table −mysql> create table DemoTable    (    Id int NOT NULL AUTO_INCREMENT PRIMARY KEY,    NumberOfQuestion int,    NumberOfSolution int    ); Query OK, 0 rows affected (0.20 sec)Insert some records in the table using insert command. Here, some of the values are NULL −mysql> insert into DemoTable(NumberOfQuestion, NumberOfSolution) values(20, 10); Query OK, 1 row affected (0.06 sec) mysql> insert into DemoTable(NumberOfQuestion, NumberOfSolution) values(20, 2); Query OK, 1 row affected (0.04 sec) mysql> insert into DemoTable(NumberOfQuestion, NumberOfSolution) values(20, NULL); Query ... Read More

Advertisements