Found 6705 Articles for Database

While adding the numbers contained in quotes, how MySQL evaluates if we write non-numeric text between numbers of a string?

Paul Richard
Updated on 20-Jun-2020 13:49:59

92 Views

Suppose if we are trying to add the numbers having non-numeric text between numbers of a string, then MySQL simply use the first number of that string to evaluate the addition along with a warning. Following example will exhibit this −Examplemysql> Select '1525 * 2' + '200'As Total; +-------+ | Total | +-------+ | 1725  | +-------+ 1 row in set, 1 warning (0.00 sec)From the above query, it is clear that MySQL uses only first number i.e. 1525 for evaluating the addition and ignores the non-numeric text.

How can we return to windows command shell from MySQL command line tool?

mkotla
Updated on 11-Feb-2020 07:08:22

466 Views

The EXIT or QUIT commands take you returned to windows from MySQL command line tool.mysql> EXITORmysql> QUIT

In MySQL, how can I combine two or more strings along with a separator?

Chandu yadav
Updated on 20-Jun-2020 13:50:36

159 Views

In MySQL, we can combine two or more strings along with a separator by using CONCAT_WS() function. The syntax of this function is CONCAT_WS(Separator, String1, String2, …, StringN)Here, the arguments of CONCAT_WS functions are Separator and the strings which need to be concatenated along with that separator as a single string. Separator except for numeric value must enclose within quotes.Examplemysql> Select CONCAT_WS('.', 'www', 'tutorialspoint', 'com'); +---------------------------------------------+ | CONCAT_WS('.', 'www', 'tutorialspoint', 'com') | +---------------------------------------------+ | www.tutorialspoint.com                      | +---------------------------------------------+ 1 row in set (0.00 sec)In this example above, we can see that the separator ... Read More

While adding the numbers contained in quotes, how MySQL evaluates if we write non-numeric text before a number?

Anjana
Updated on 20-Jun-2020 13:58:45

82 Views

Suppose if we are trying to add the numbers having non-numeric text before them, then MySQL simply evaluate the value of such number as 0. Following example will exhibit this −Examplemysql> Select 'Kg 1525' + 'Oz 200'As Total; +-------+ | Total | +-------+ | 0     | +-------+ 1 row in set, 2 warnings (0.00 sec) mysql> Select 'Kg 1525' + '200'As Total; +-------+ | Total | +-------+ | 200   | +-------+ 1 row in set, 1 warning (0.00 sec)

How can we find out the storage engine used for a particular table in MySQL?

Govinda Sai
Updated on 20-Jun-2020 13:48:16

118 Views

The following MySQL statement can find out the storage engine used for ‘Student’ table in database named ‘tutorial’ −mysql> SELECT ENGINE FROM information_schema.TABLES   -> WHERE TABLE_SCHEMA = 'tutorial'   -> AND TABLE_NAME = 'Student'; +--------+ | ENGINE | +--------+ | MyISAM | +--------+ 1 row in set (0.13 sec)

While creating a MySQL table, how can I specify the storage engine of my choice rather than using the default storage engine InnoDB?

Ramu Prasad
Updated on 20-Jun-2020 13:47:45

126 Views

While creating a MySQL table, the storage engine can be specified as follows −mysql> CREATE TABLE Student(id INTEGER PRIMARY KEY, Name VARCHAR(15)) -> ENGINE = 'MyISAM'; Query OK, 0 rows affected (0.28 sec)The ENGINE keyword specifies the storage engine used for this particular table.

While adding the numbers contained in quotes, how MySQL evaluates if we write non-numeric text after a number?

Rama Giri
Updated on 20-Jun-2020 13:47:16

83 Views

Suppose if we are trying to add the numbers having non-numeric text after them, then MySQL simply discard the non-numeric text and evaluates the addition of numeric values along with warnings. Following example will exhibit this −Examplemysql> Select '1525 Kg' + '200 Oz'As Total; +-------+ | Total | +-------+ | 1725  | +-------+ 1 row in set, 2 warnings (0.00 sec)

How MySQL evaluates if I try to add two numbers that are contained in quotes?

Lakshmi Srinivas
Updated on 20-Jun-2020 13:46:39

106 Views

If we are trying to add two numbers that are contained in quotes, means we are treating the string as a number. In this case, MySQL converts the value into the closet numeric equivalent and evaluates the result. Following example will demonstrate it.Examplemysql> Select '1525' + '200'As Total; +-------+ | Total | +-------+ | 1725  | +-------+ 1 row in set (0.00 sec)

What kind of string comparison, case-sensitive or not, can be performed by MySQL?

Vikyath Ram
Updated on 20-Jun-2020 13:46:14

240 Views

MySQL cannot perform a case-sensitive comparison when comparing characters. It can be illustrated with the following example from table ‘Employee’ having the following data −mysql> Select * from Employee; +----+--------+--------+ | ID | Name   | Salary | +----+--------+--------+ | 1  | Gaurav | 50000  | | 2  | Rahul  | 20000  | | 3  | Advik  | 25000  | | 4  | Aarav  | 65000  | | 5  | Ram    | 20000  | | 6  | Mohan  | 30000  | | 7  | Aryan  | NULL   | | 8  | Vinay  | NULL   | +----+--------+--------+ 8 rows in set (0.09 sec)The result set of the following query shows that MySQL is not case sensitive when comparing characters.mysql> Select * from Employee WHERE Name IN ('gaurav','RAM'); +----+--------+--------+ | ID | Name   | Salary | +----+--------+--------+ | 1  | Gaurav | 50000  | | 5  | Ram    | 20000  | +----+--------+--------+ 2 rows in set (0.00 sec)

How MySQL can perform case-sensitive string comparison?

Ankith Reddy
Updated on 17-Feb-2020 06:01:43

667 Views

As we know that MySQL is not case-sensitive while comparing characters but it can be changed i.e. MySQL can perform case-sensitive string comparison if we will use BINARY keyword before the expression. Actually, BINARY keyword instructs MySQL to compare the characters in the string using their underlying ASCII values rather than just their letters. It can be illustrated with the following example from table ‘Employee’ having the following data −mysql> Select * from Employee; +----+--------+--------+ | ID | Name   | Salary | +----+--------+--------+ | 1  | Gaurav | 50000  | | 2  | Rahul  | 20000  | | 3 ... Read More

Advertisements