Combine Multiple Advanced MySQL SELECT Queries

AmitDiwan
Updated on 22-Aug-2019 12:13:50

452 Views

To combine multiple advanced MySQL select queries, use UNION. Let us first create a table −mysql> create table DemoTable1 (Value1 int, Value2 int); Query OK, 0 rows affected (0.62 sec)Insert some records in the table using insert command −mysql> insert into DemoTable1 values(10, 29); Query OK, 1 row affected (0.11 sec) mysql> insert into DemoTable1 values(100, 190); Query OK, 1 row affected (0.19 sec) mysql> insert into DemoTable1 values(40, 101); Query OK, 1 row affected (0.12 sec)Display all records from the table using select statement −mysql> select *from DemoTable1;This will produce the following output −+--------+--------+ | Value1 | Value2 | ... Read More

HTML DOM Input Range Max Property

AmitDiwan
Updated on 22-Aug-2019 12:11:34

221 Views

The HTML DOM Input Range max property is used for setting or returning the max attribute value for the range slider control. This attribute is used for indicating the maximum value of the slider control and is often used with min property to create a range of values between which the slider can move.SyntaxFollowing is the syntax for −Setting the Range max property −rangeObject.max = numberHere, number represents maximum slider control value.ExampleLet us look at an example for the Input range max property − Live Demo Range max property VOLUME Get the maximum value for the above ... Read More

Implement Opposite of INITCAP Functionality with MySQL

AmitDiwan
Updated on 22-Aug-2019 12:10:24

300 Views

The INITCAP() method display the first character in every word in uppercase and rest in lowercase.To implement the opposite functionality, you need to create your own function in MySQL. Here’s the function −mysql> delimiter // mysql> create function convertFirstLetterToLowerAndRemainingToCapital(value varchar(250))    returns varchar(250)    deterministic    begin    declare valueLength int;    declare l int;    set valueLength = char_length(value);    set value = upper(value);    set l = 0;    while (l < valueLength ) do       if (mid(value, l ,1) = ' ' or l = 0) then          if (l < valueLength ... Read More

HTML DOM Input Range Form Property

AmitDiwan
Updated on 22-Aug-2019 12:05:07

152 Views

The HTML DOM Input Range form property is used for returning the form reference that contains the given input range slider. If the range slider is outside the form then it will simply return NULL. This property is read-only.SyntaxFollowing is the syntax for input range form property.rangeObject.formExampleLet us look at an example for the Input range form property − Live Demo Input range form Property Get the form id which contains the above range slider clicking on the below button GET FORM    function formId() {       var P=document.getElementById("RANGE1").form.id;       ... Read More

Concatenate Data from Multiple Rows Using GROUP_CONCAT in MySQL

AmitDiwan
Updated on 22-Aug-2019 11:57:57

285 Views

Let us first create a table −mysql> create table DemoTable (CountryName varchar(100)); Query OK, 0 rows affected (1.01 sec)Insert some records in the table using insert command −mysql> insert into DemoTable values('US'); Query OK, 1 row affected (0.18 sec) mysql> insert into DemoTable values('AUS'); Query OK, 1 row affected (0.13 sec) mysql> insert into DemoTable values('UK'); Query OK, 1 row affected (0.19 sec)Display all records from the table using select statement −mysql> select *from DemoTable;This will produce the following output −+-------------+ | CountryName | +-------------+ | US          | | AUS         | | ... Read More

HTML DOM Input Range Autofocus Property

AmitDiwan
Updated on 22-Aug-2019 11:54:00

173 Views

The HTML DOM input range autofocus property is associated with the HTML element’s autofocus attribute. This property is used for setting or returning if the input range slider should be automatically focused when the page loads or not.SyntaxFollowing is the syntax for −Setting the autofocus property −rangeObject.autofocus = true|falseHere, true represents the range slider should get focus and the false represents otherwise. It is set to false by default.ExampleLet us look at an example for the Input range autofocus property − Live Demo Input range autofocus property CHECK    function rangeFocus() { ... Read More

Install or Enable InnoDB in MySQL

AmitDiwan
Updated on 22-Aug-2019 11:52:16

2K+ Views

In order to enable innoDB in MySQ, you need to work around my.ini file. However, in MySQL version 8, the default storage engine is innoDB. Check the same from my.ini file −You can even set this at the time of table creation −mysql> create table DemoTable    (    StudentId int NOT NULL AUTO_INCREMENT PRIMARY KEY,    StudentFirstName varchar(100),    StudentLastName varchar(100),    StudentAge int    ) ENGINE=InnoDB; Query OK, 0 rows affected (1.66 sec)Let us now run a query to check the engine type of specific table −mysql> select table_name, engine from information_schema.tables where table_name="DemoTable";This will produce the following ... Read More

HTML DOM Input Radio Value Property

AmitDiwan
Updated on 22-Aug-2019 11:48:05

224 Views

The HTML DOM Input radio value property is associated with the input element having type=”radio” and the value attribute. It is used to return the value of radio button value attribute or to set it.The value property for radio button doesn’t affect the user interface of the website as the content is simply not displayed. However it can be used to distinguish between several buttons of the same group when the form is submitted.SyntaxFollowing is the syntax for −Set the value property −radioObject.value = text;Here, text is used for specifying the value for the radio button.ExampleLet us look at an ... Read More

HTML DOM Input Radio Type Property

AmitDiwan
Updated on 22-Aug-2019 11:43:33

211 Views

The HTML DOM Input radio type property is associated with the input element having its type=”radio”. It will always return radio for the input radio element.SyntaxFollowing is the syntax for radio type property −radioObject.typeExampleLet us look at an example for the radio type property − Live Demo Input radio type Property FRUIT: Mango Get the above input element type by clicking the below button GET Type    function radioType() {       var P=document.getElementById("Mango").type;       document.getElementById("Sample").innerHTML = "The type for the input field is: "+P ;    } OutputThis ... Read More

Get At Least X Number of Rows in MySQL

AmitDiwan
Updated on 22-Aug-2019 11:39:50

203 Views

To get at least x number of rows, you need to use the LIMIT clause. Following is the syntax −select *from yourTableName order by yourColumnName DESC limit yourXNumberOfRows;Let us first create a table −mysql> create table DemoTable (    EmployeeId int NOT NULL AUTO_INCREMENT PRIMARY KEY, EmployeeName varchar(100) ); Query OK, 0 rows affected (0.76 sec)Insert some records in the table using insert command −mysql> insert into DemoTable(EmployeeName) values('Chris'); Query OK, 1 row affected (0.17 sec) mysql> insert into DemoTable(EmployeeName) values('David'); Query OK, 1 row affected (0.12 sec) mysql> insert into DemoTable(EmployeeName) values('Bob'); Query OK, 1 row affected (0.51 sec) ... Read More

Advertisements