MySQL Function to Determine String Length in Bits

Kumar Varma
Updated on 20-Jun-2020 08:17:21

137 Views

MySQL BIT_LENGTH() string function is used to get the length of the string in bits.SyntaxBIT_LENGTH(Str)Here Str, the argument of BIT_LENGTH() function, is the string whose BIT_LENGTH value is to be retrieved. Str can be a character string or number string. If it is a character string then it must be in quotes.Examplemysql> Select BIT_LENGTH('New Delhi'); +-------------------------+ | BIT_LENGTH('New Delhi') | +-------------------------+ | 72                      | +-------------------------+ 1 row in set (0.00 sec) mysql> select BIT_LENGTH(123456); +--------------------+ | BIT_LENGTH(123456) | +--------------------+ | 48                 | +--------------------+ 1 row in set (0.00 sec)

Pass Empty String as Parameter to BIT_LENGTH Function in MySQL

Akshaya Akki
Updated on 20-Jun-2020 08:16:21

284 Views

Whenever we want to pass an empty string as a parameter to BIT_LENGTH() function then we must have to pass blank quotes (even without any space). It cannot pass without quotes because MySQL then resembles it as the function without any argument and returns an error. But, when we pass an empty string with blank quotes then MySQL will return 0 as output. It can be understood with the following example as well −Examplemysql> Select BIT_LENGTH(); ERROR 1582 (42000): Incorrect parameter count in the call to native function 'BIT_LENGTH' mysql> Select BIT_LENGTH(''); +----------------+ | BIT_LENGTH('') | +----------------+ | 0 ... Read More

Mobile Databases

Alex Onsman
Updated on 20-Jun-2020 08:14:28

9K+ Views

Mobile databases are separate from the main database and can easily be transported to various places. Even though they are not connected to the main database, they can still communicate with the database to share and exchange data.The mobile database includes the following components −The main system database that stores all the data and is linked to the mobile database.The mobile database that allows users to view information even while on the move. It shares information with the main database.The device that uses the mobile database to access data. This device can be a mobile phone, laptop etc.A communication link ... Read More

Multidimensional Databases

Alex Onsman
Updated on 20-Jun-2020 08:11:30

9K+ Views

Multidimensional databases are used mostly for OLAP (online analytical processing) and data warehousing. They can be used to show multiple dimensions of data to users .A multidimensional database is created from multiple relational databases. While relational databases allow users to access data in the form of queries, the multidimensional databases allow users to ask analytical questions related to business or market trends.The multidimensional databases uses MOLAP (multidimensional online analytical processing) to access its data. They allow the users to quickly get answers to their requests by generating and analysing the data rather quickly.The data in multidimensional databases is stored in ... Read More

MySQL Function Equivalent to BIN Function

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

153 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

4K+ 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

159 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

739 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

Advertisements