Submit button automatically submits a form on click. Using HTML forms, you can easily take user input. The tag is used to get user input, by adding the form elements. Different types of form elements include text input, radio button input, submit button, etc.Let’s learn about how to use the submit button in HTML forms. It is also created using HTML tag but type attribute is set to button.You can try to run the following code to use submit button to submit and reset a form. Under the action, attribute add the file, where you want to reach after ... Read More
The COALESCE() finds the NON-NULL value first If it finds the same in the beginning, then it returns, otherwise moves ahead to check NON-NULL value.Let us first create a table −mysql> create table DemoTable ( Number1 int, Number2 int ); Query OK, 0 rows affected (5.48 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values(100, 200); Query OK, 1 row affected (0.40 sec) mysql> insert into DemoTable values(NULL, 50); Query OK, 1 row affected (0.13 sec) mysql> insert into DemoTable values(10, NULL); Query OK, 1 row affected (0.15 sec) mysql> insert into DemoTable ... Read More
Betrothed numbers are pair of two numbers in a way that the sum of their divisors when added by is equal to another number.For example (a, b) are a pair of betrothed numbers if s(a) = b + 1 and s(b) = a + 1, where s(b) is the aliquot sum of b: an equivalent condition is that σ(a) = σ(b) = a + b + 1, where σ denotes the sum-of-divisors function.The first few pairs of betrothed numbers are: (48, 75), (140, 195), (1050, 1925), (1575, 1648), (2024, 2295), (5775, 6128).All known pairs of betrothed numbers have opposite parity. Any pair of the same parity must exceed 1010.AlgorithmStep 1: Find the sum of all divisors for both numbers. Step 2: Finally ... Read More
To find the latest dates, order the date records with ORDER BY DESC. Since we want only 3 dates, use LIMIT 3.Let us first create a table −mysql> create table DemoTable ( AdmissionDate date ); Query OK, 0 rows affected (0.56 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values('2019-09-04'); Query OK, 1 row affected (0.09 sec) mysql> insert into DemoTable values('2019-08-10'); Query OK, 1 row affected (0.16 sec) mysql> insert into DemoTable values('2019-09-21'); Query OK, 1 row affected (0.13 sec) mysql> insert into DemoTable values('2019-09-18'); Query OK, 1 row affected (0.17 sec) mysql> ... Read More
Finding the array index with the same count of even or odd number is a number that has equal number of either numbers or odd number on both sides of it i.e. no.s at left = no.s right.Here, we need a few definitions that are related to the concept, Array − A container of elements of same data type.Array Index − The position of an element is called its index. Index of array always start from 0.Even number − A number that is divisible by 2.Odd number − A number that is not divisible by 2.A whole number can either ... Read More
Let us first create a table −mysql> create table DemoTable ( StudentId int NOT NULL AUTO_INCREMENT PRIMARY KEY, StudentName varchar(30) ); Query OK, 0 rows affected (0.70 sec)Insert some records in the table using insert command −mysql> insert into DemoTable(StudentName) values('John Smith'); Query OK, 1 row affected (0.13 sec) mysql> insert into DemoTable(StudentName) values('David Miller'); Query OK, 1 row affected (0.12 sec) mysql> insert into DemoTable(StudentName) values('Carol Taylor'); Query OK, 1 row affected (0.12 sec) mysql> insert into DemoTable(StudentName) values('John Doe'); Query OK, 1 row affected (0.13 sec) mysql> insert into DemoTable(StudentName) values('Chris Brown'); Query OK, 1 row ... Read More
Let us first create a table −mysql> create table DemoTable ( Number text ); Query OK, 0 rows affected (0.49 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values('7364746464, -'); Query OK, 1 row affected (0.21 sec) mysql> insert into DemoTable values('-, 8909094556'); Query OK, 1 row affected (0.23 sec)Display all records from the table using select statement −mysql> select *from DemoTable;This will produce the following output −+--------------+ | Number | +--------------+ | 7364746464, - | | -, 8909094556 | +--------------+ 2 rows in set (0.00 sec)Following is ... Read More
Array is a container of elements of same data type.Prime Frequencies means that the number of occurrence of the element of the array is a prime number.So, based on these definitions the problem to find array elements with prime frequencies. We are given a string of array. We have to find the frequency of characters and check if frequency is prime and then count elements that have prime frequencies.Let’s take an example, Input: str = “helloworld” Output: 2ExplanationCount of occurrences of characters are −h -> 1 e -> 1 l -> 3 o -> 2 w-> 1 r -> 1 ... Read More
For this, use the CAST() method in MySQL. Let us first create a table −mysql> create table DemoTable ( Id int NOT NULL AUTO_INCREMENT PRIMARY KEY, StudentHeight varchar(40) ) ; Query OK, 0 rows affected (0.47 sec)Insert some records in the table using insert command −mysql> insert into DemoTable(StudentHeight) values('5\'10\"'); Query OK, 1 row affected (0.13 sec) mysql> insert into DemoTable(StudentHeight) values('4\'6\"'); Query OK, 1 row affected (0.14 sec) mysql> insert into DemoTable(StudentHeight) values('5\'8\"'); Query OK, 1 row affected (0.10 sec)Display all records from the table using select statement −mysql> select *from DemoTable;This will produce the following output ... Read More
Array is a container of elements of Same data types length needs to be defined beforehand. And an element can appear in any order and any number of times in an array. so in this program we will find elements that appear more than once in an array.Problem description − We have given an array arr[] in which we have to find which of the element are repeating in the array an app to print them.Let’s take an example to understand this better.Example, Input: arr[] = {5, 11, 11, 2, 1, 4, 2} Output: 11 2ExplanationWe have an array arr ... Read More