Jai Janardhan

Jai Janardhan

40 Articles Published

Articles by Jai Janardhan

Page 2 of 4

How to set the right margin of an element with JavaScript?

Jai Janardhan
Jai Janardhan
Updated on 23-Jun-2020 649 Views

Use the marginRight property in JavaScript, to set the right margin. You can try to run the following code to set the right margin of an element with JavaScript − Example             #myID {        border: 2px solid #000000;      }              This is demo text.    Add right margin          function display() {        document.getElementById("myID").style.marginRight = "150px";      }       

Read More

How to set the position of the list-item marker with JavaScript?

Jai Janardhan
Jai Janardhan
Updated on 23-Jun-2020 239 Views

To set the position of the marker of the list-item, use the listStylePosition property. You can try to run the following code to set the position of the list-item marker with JavaScript − Example             One      Two        Add list inside    Add list outside          function displayInside() {       document.getElementById("myID").style.listStylePosition = "inside";      }      function displayOutside() {       document.getElementById("myID").style.listStylePosition = "outside";      }       

Read More

How to set whether the style of the font is normal, italic or oblique with JavaScript?

Jai Janardhan
Jai Janardhan
Updated on 23-Jun-2020 164 Views

To set the style of the font, use the fontStyle property. You can try to run the following code to set the style of the font to normal, italic or oblique with JavaScript − Example       Heading 1          This is Demo Text. This is Demo Text. This is Demo Text. This is Demo Text.      This is Demo Text. This is Demo Text. This is Demo Text. This is Demo Text.        Set Font Family and Style          function display() {       document.getElementById("myID").style.fontFamily = "verdana,sans-serif";       document.getElementById("myID").style.fontStyle = "italic";      }       

Read More

How to create a table caption with JavaScript DOM?

Jai Janardhan
Jai Janardhan
Updated on 23-Jun-2020 649 Views

To create a table caption, use the DOM createCaption() method. Example You can try to run the following code to learn how to create table caption −             function captionFunc(x) {        document.getElementById(x).createCaption().innerHTML = "Demo Caption";      }                            One        Two                    Three        Four                    Five        Six                           

Read More

How can I return the values of columns from MySQL table as a set of values?

Jai Janardhan
Jai Janardhan
Updated on 22-Jun-2020 278 Views

With the help of MySQL MAKE_SET() function, we can return the values of columns from MySQL table as a set of values. To understand it, we are taking the example of Student_Name table which has the following data −mysql> Select * from Student_Name; +---------+-------+---------+ | FName   | Mname | Lname   | +---------+-------+---------+ | Rahul   | NULL  | Singh   | | Gaurav  | Kumar | NULL    | | Harshit | NULL  | Khurana | | Yash    | Pal   | Sharma  | +---------+-------+---------+ 4 rows in set (0.00 sec)Now, suppose if we want to make ...

Read More

What is the use of MySQL IFNULL() control flow function?

Jai Janardhan
Jai Janardhan
Updated on 22-Jun-2020 299 Views

MySQL IFNULL() control flow function will return the first argument if it is not NULL otherwise it returns the second argument.SyntaxIFNULL(expression1, expression2)Here if expression1 is not NULL then IFNULL() will return expression1 otherwise expression2. It will return NULL if both of the arguments are NULL. Following example will exhibit this −mysql> Select IFNULL(NULL, 'Ram'); +--------------------+ | IFNULL(NULL, 'Ram') | +--------------------+ | Ram                | +--------------------+ 1 row in set (0.00 sec) mysql> Select IFNULL('Shyam', 'Ram'); +-----------------------+ | IFNULL('Shyam', 'Ram') | +-----------------------+ | Shyam                 | +-----------------------+ ...

Read More

How MySQL FIELD() and ELT() functions are complements of each other?

Jai Janardhan
Jai Janardhan
Updated on 20-Jun-2020 216 Views

On the basis of the working of both the functions, we can say that both are the complement of each other. Actually, as we know that FIELD() function, on providing a string as an argument, returns the index number of the string from string list and ELT() function, on providing index number as an argument, returns the string from string list. In the following example, we have applied both the functions on the same string, it would demonstrate the concept −Examplemysql> SELECT ELT(4, 'Ram', 'is', 'good', 'boy')As Result; +--------+ | Result | +--------+ | boy    | +--------+ ...

Read More

How wildcard characters can be used with MySQL CONCAT() function?

Jai Janardhan
Jai Janardhan
Updated on 20-Jun-2020 811 Views

As we know that wildcards are characters that help search data matching complex criteria. Wildcards are used in conjunction with LIKE comparison operator or NOT LIKE comparison operator. MySQL allows us to match the data, from the output of CONCAT() function, with the help of wildcard and comparison operators LIKE or NOT LIKE. An example from ‘Student’ table is given to make it clearer.Examplemysql> Select CONCAT(Name, ' ', Last_name) AS NAME from student Where CONCAT(Name, ' ', Last_Name) LIKE '%Kumar%'; +---------------+ | NAME          | +---------------+ | Gaurav Kumar  | | Harshit Kumar | +---------------+ ...

Read More

How can we update columns values on multiple rows with a single MySQL UPDATE statement?

Jai Janardhan
Jai Janardhan
Updated on 20-Jun-2020 4K+ Views

Column values on multiple rows can be updated in a single UPDATE statement if the condition specified in WHERE clause matches multiple rows. In this case, the SET clause will be applied to all the matched rows.ExampleSuppose we have a table ‘tender’ as follows −mysql> Select * from tender; +-----------+---------+------+ | tender_id | company | rate | +-----------+---------+------+ | 200       | ABC     | 1000 | | 300       | ABD     | 5000 | | 301       | ABE     | 6000 | | 302       ...

Read More

How can we apply a NOT NULL constraint to a column of an existing MySQL table?

Jai Janardhan
Jai Janardhan
Updated on 19-Jun-2020 477 Views

We can apply the NOT NULL constraint to a column of an existing MySQL table with the help of ALTER TABLE statement. SyntaxALTER TABLE table_name MODIFY colum_name datatype NOT NULL; Examplemysql> Create table test123(ID INT, Date DATE); Query OK, 0 rows affected (0.19 sec) mysql> Describe test123; +-------+---------+------+-----+---------+-------+ | Field | Type    | Null | Key | Default | Extra | +-------+---------+------+-----+---------+-------+ | ID    | int(11) | YES  |     | NULL    |       | | Date  | date    | YES  |     | NULL    |       | +-------+---------+------+-----+---------+-------+ ...

Read More
Showing 11–20 of 40 articles
Advertisements