MySQL Function Equivalent to BIN Function

Swarali Sree
Updated on 20-Jun-2020 08:11:07

138 Views

As we know that BIN() function returns the binary string of a number, of the DECIMAL base, after converting it into a binary value. In this way, it can be considered same as CONV(N, 10, 2) function. It means the output of CONV(N, 10, 2) would be same as the output of BIN() function.In CONV(N, 10, 2) function, ‘N’ is the number which will be converted, 10 represents the base, i.e. DECIMAL, of N and 2 represents that we want to convert N into a binary string.ExampleThe example below will demonstrate that the output return by BIN() is same as ... Read More

Insert New Row into Table at a Certain Index using jQuery

Kristi Castro
Updated on 20-Jun-2020 08:09:28

2K+ Views

To insert a new row into table at a certain index, use the jQuery val() and insertBefore() method. You can try to run the following code to learn how to insert new row into table −ExampleLive Demo     jQuery Example       $(document).ready(function(){               $('#index').val($('#myTable tbody tr').length);     $('#btn1').click(function(){       var indx = $('#index').val()-1;       var newRow = $('New row is added at index '+$('#myTable tbody tr').length+'');       newRow.insertBefore($('#myTable tbody tr:nth('+indx+')'));    });   });                   This is row 1                   This is row 2                 Add

Set Content of an iFrame without src using jQuery

Kristi Castro
Updated on 20-Jun-2020 08:08:20

2K+ Views

To set the content of an iframe without src, use the jQuery html() method. You can try to run the following code to learn how to set the content of an iframe without src attribute −ExampleLive Demo      jQuery Selector                  $(document).ready(function() {     var context = $('iframe')[0].contentWindow.document;     var $body = $('body', context);     $body.html('Hello World!');   });        

Difference Between MySQL LENGTH and CHAR_LENGTH Function

Arushi
Updated on 20-Jun-2020 08:07:49

3K+ Views

Both the functions are string functions and return the number of characters present in the string. But they differ in the concept that CHAR_LENGTH() function measures the string length in ‘characters’ whereas LENGTH() function measures the string length in ‘bytes’. In other words, we can say that CHAR_LENGTH() function is multi-byte safe i.e. it ignores whether the characters are single-byte or multi-byte. For example, if a string contains four 2-bytes characters then LENGTH().The function will return 8, whereas CHAR_LENGTH() function will return 4. In this sense, we can say that CHAR_LENGTH() gives precise result than LENGTH() function.The difference is especially ... Read More

Get Children of the 'this' Selector in jQuery

Kristi Castro
Updated on 20-Jun-2020 08:07:11

151 Views

To get the children of the $(this) selector, use the jQuery find() method. You can try to run the following code to get the children of the $(this) selector −ExampleLive Demo   jQuery Example       $(document).ready(function(){     $('#mydiv').click(function(){       alert($(this).find('img:last-child').attr('src'));    });   });   #my_div {    width: 200px;    height: 200px;    background-color: red;   }    

Center a Div on the Screen Using jQuery

Kristi Castro
Updated on 20-Jun-2020 08:05:51

718 Views

To center a div on the screen, use the jQuery centering function jQuery.fn.center. You can try to run the following code to learn how to center a div on the screen:ExampleLive Demo               $(document).ready(function(){       jQuery.fn.center = function(parent) {         if (parent) {           parent = this.parent();         } else {           parent = window;         }       this.css({        "position": "absolute",        "top": ((($(parent).height() ... Read More

Count Number of Columns in a Table with jQuery

Kristi Castro
Updated on 20-Jun-2020 08:04:48

805 Views

To count number of columns in a table with jQuery, use the each() function with attr(). You can try to run the following code to learn how to count column in a table:EaxmpleLive Demo       jQuery Example             $(document).ready(function(){       var num = 0;       $('tr:nth-child(1) td').each(function () {         if ($(this).attr('colspan')) {           num += +$(this).attr('colspan');         } else {         num++;       }     });    alert("Total Columns= "+num); });         -1st column-     -2nd column-     -3rd column-    

Check If Table Row Is In View Using jQuery

Kristi Castro
Updated on 20-Jun-2020 08:03:51

1K+ Views

To check if table row exists or not, use the is() method, with the :visible selector −if($(".row").is(":visible")) {   alert("Visible!"); }You can try to run the following code to learn how to chck if a row exists or not. It even notifies when a new row is created −ExampleLive Demo   jQuery - Add Table Rows     table{    width: 100%;    margin: 25px 0;    border-collapse: collapse;   }   table, th, td{    border: 1px solid #6C220B;   }   table th, table td{    padding: 8px;    text-align: left;   }   ... Read More

Call jQuery Function After a Certain Delay

Kristi Castro
Updated on 20-Jun-2020 08:02:01

6K+ Views

To call a jQuery function after a certain delay, use the siteTimeout() method. Here, jQuery fadeOut() function is called after some seconds.You can try to run the following code to learn how to work with setTimeout() method in jQuery to call a jQuery function after a delay −ExampleLive Demo         $(document).ready(function(){     $("#button1").bind("click",function() {       setTimeout(function() {         $('#list').fadeOut();}, 2000);     });   });                    Voice        Speak      Write         The above content will fade out after 2 seconds

Conversion Functions in SQL

David Meador
Updated on 20-Jun-2020 08:00:07

2K+ Views

There may be times when the SQL query was expecting some data type but it got another. In that case type conversion is done by SQL. This is implicit type conversion. However, sometimes the programmer explicitly converts one data type into another in a query. This is known as explicit type conversion. Both of these in detail are given as follows:Implicit Data Type ConversionIn implicit data type conversion, the SQL programmer does not specify anything. Rather the system converts one type of data to another as per its requirements. For example - a numeric data type can be converted to ... Read More

Advertisements