Found 4219 Articles for MySQLi

What is TEXT data type in MySQL?

Daniol Thomas
Updated on 20-Jun-2020 08:30:41

11K+ Views

TEXT data objects are useful for storing long-form text strings in a MySQL database. Followings are some point about TEXT data type −TEXT is the family of column type intended as high-capacity character storage.The actual TEXT column type is of four types-TINYTEXT, TEXT, MEDIUMTEXT and LONGTEXT.The four TEXT types are very similar to each other; the only difference is the maximum amount of data each can store.The smallest TEXT type, TINYTEXT shares the same character length as VARCHAR.TEXT values are treated as character strings.TEXT has character set other than binary character set and collation.The comparisons and sorting are based on ... Read More

How MySQL CONCAT() function, applied to the column/s of a table, can be combined with the column/s of other tables?

Samual Sam
Updated on 20-Jun-2020 08:29:24

71 Views

We can use the output of CONCAT() function which is applied to the column/s of a MySQL with the column/s of another MySQL table. It can be done with the help of MySQL join.ExampleFor example, we have two table ‘Student’, having the details like id, Name, Last_name, Address and Subjects of the students, and ‘Remarks’, having the id and comments about the students. Now, the following query can combine CONCAT() function with another table column −mysql> Select * from remarks; +------+-------------+ | ID   | Comment     | +------+-------------+ | 1    | Good        | | ... Read More

What is the maximum length of data we can put in a BLOB column in MySQL?

Giri Raju
Updated on 20-Jun-2020 08:30:05

3K+ Views

As we know that BLOB is a binary large object that can hold a variable amount of data. The different TEXT objects offer a range of storage space from 255 bytes to 4 Gb. Following table shows the storage of different kinds of BLOB data type −Type of BLOBMaximum amount of Data that can be storedOverhead TINYBLOBUp to 255 bytes1 byteBLOBUp to 64 Kb2 bytes MEDIUMBLOBUp to 16 Mb3 bytes LONGBLOBUp to 4 Gb1 Bytes

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

Jai Janardhan
Updated on 20-Jun-2020 08:26:10

478 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

What MySQL returns if we pass column name, containing a NULL value, as one of the arguments of CONCAT() function?

Rishi Raj
Updated on 20-Jun-2020 08:22:31

66 Views

As we know that CONCAT() function will return NULL if any of the argument of it is NULL. It means MySQL will return NULL if we pass column name, containing a NULL value, as one of the arguments of CONCAT() function. Following is an example of ‘Student’ table to explain it.ExampleIn this example, we are concatenating the values of two strings and at 5th row one, the value is NULL hence the concatenation result is also NULL.mysql> Select Name, Address, CONCAT(Name, ' Resident of ', Address)AS 'Detail of Student' from Student; +---------+---------+---------------------------+ | Name    | Address | Detail ... Read More

How can CONCAT() function be used with MySQL WHERE clause?

Anjana
Updated on 30-Jan-2020 07:18:40

2K+ Views

Suppose from the table ‘Student’ we want to concatenate the values of columns, ‘Name’, ‘Address’ and ‘Columns’, based on the condition that is also a concatenation of values from columns, ’Name’, ‘Subject’, provided in WHERE clause with the help of CONCAT() function. We can use the following query to give the output −mysql> Select CONCAT(Name, ' ', 'Resident of', ' ', Address, ' ', 'is', ' ', 'Studying', ' ', Subject)AS 'Detail of Student' from Student WHERE CONCAT(Name, Subject) = "AaravHistory"; +----------------------------------------------+ | Detail of Student                            | ... Read More

How can CONCAT() function be applied on columns of MySQL table?

Manikanth Mani
Updated on 30-Jan-2020 07:20:26

119 Views

We can use CONCAT() function to combine the values of two or more columns. In this case, the arguments of the CONCAT() functions would be the name of the columns. For example, suppose we have a table named ‘Student’ and we want the name and address of the student collectively in one column then the following query can be written −mysql> Select Id, Name, Address, CONCAT(ID, ', ', Name, ', ', Address)AS 'ID, Name, Address' from Student; +------+---------+---------+--------------------+ | Id   | Name    | Address | ID, Name, Address  | +------+---------+---------+--------------------+ | 1    | Gaurav  | Delhi   ... Read More

What happens if I pass only one argument to the MySQL CONCAT() function?

Rama Giri
Updated on 20-Jun-2020 08:21:10

127 Views

MySQL allows us to pass only one argument to the CONCAT() function. In this case, MySQL returns the same argument as output. Following example will exhibit it −Examplemysql> Select Concat('Delhi'); +-----------------+ | Concat('Delhi') | +-----------------+ | Delhi           | +-----------------+ 1 row in set (0.00 sec)

How to add two or more strings in MySQL?

Fendadis John
Updated on 20-Jun-2020 08:18:58

794 Views

A string function called CONCAT() is used to concatenate two or more strings as a single string in MySQL.SyntaxCONCAT(String1,String2,…,StringN)Here, the arguments of CONCAT functions are the strings which need to be concatenated as a single string.Examplemysql> Select CONCAT('Ram','is','a','good','boy') AS Remarks; +---------------+ | Remarks       | +---------------+ | Ramisagoodboy | +---------------+ 1 row in set (0.00 sec)

How can we pass an empty string as a parameter to BIT_LENGTH() function and what would be returned by MySQL?

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

182 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

Advertisements