Sharon Christine has Published 413 Articles

How can we create a MySQL view with a subquery?

Sharon Christine

Sharon Christine

Updated on 22-Jun-2020 13:51:28

2K+ Views

To illustrate the making of MySQL view with subquery we are using the following data from the table ‘Cars’ −mysql> select * from cars; +------+--------------+---------+ | ID   | Name         | Price   | +------+--------------+---------+ |    1 | Nexa         | 750000 ... Read More

What are the different status variables in MySQL which provide us the countsof event-related operations?

Sharon Christine

Sharon Christine

Updated on 22-Jun-2020 12:49:04

66 Views

Followings are the status variables in MYSQL which provide us the counts of event-related operations −Com_create_event It provides us the number of CREATE EVENT statements executed since the last server restart.Com_alter_event − It provides us the number of ALTER EVENT statements executed since the last server restart.Com_drop_event − It provides ... Read More

How can we get the metadata of triggers?

Sharon Christine

Sharon Christine

Updated on 22-Jun-2020 11:46:12

196 Views

It can be done with the help of the INFORMATION_SCHEMA database. Following statement will give us the metadata of triggers −mysql> Select trigger_schema, trigger_name, action_statement     -> from information_schema.triggers\G *************************** 1. row ***************************   trigger_schema: query     trigger_name: trigger_before_delete_sample action_statement: BEGIN SET @count = if (@count IS NULL, ... Read More

Which statement, other than START TRANSACTION, is used for starting a transaction?

Sharon Christine

Sharon Christine

Updated on 22-Jun-2020 11:10:21

228 Views

We can also use the BEGIN statement to start a new transaction. It is the same as the START TRANSACTION statement.Examplemysql> BEGIN; Query OK, 0 rows affected (0.00 sec) mysql> INSERT INTO Marks Values(1, 'Aarav', 'History', 40); Query OK, 1 row affected (0.00 sec) mysql> INSERT INTO Marks ... Read More

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

Sharon Christine

Sharon Christine

Updated on 22-Jun-2020 06:25:31

3K+ Views

As we know that WHERE clause is used to put condition/s in MySQL query and MySQL returns result set based on those conditions. Similarly when we use REPLACE() function with WHERE clause, the result set will depend upon the conditions provided. Following is an example by using data from the ... Read More

What is MySQL NULL-safe equal operator and how it is different from comparison operator?

Sharon Christine

Sharon Christine

Updated on 22-Jun-2020 06:21:17

373 Views

MySQL NULL-safe equal operator, equivalent to standard SQL IS NOT DISTINCT FROM operator, performs an equality comparison like = operator. Its symbol is . It performs differently from the comparison operators in the case when we have NULL as both the operands. Consider the following examples to understand NULL-safe operator ... Read More

In MySQL, what is Bit-field notation and how it can be used to write bit-field value?

Sharon Christine

Sharon Christine

Updated on 22-Jun-2020 05:41:38

454 Views

Bit-field notation is the notation with the help of which we can write bit-field values. The syntax of Bit-field notation is as follows −Syntaxb’value’   OR 0bvalueHere, the value is a binary value written by using zeros and ones.The mainly Bit-filed notation is convenient for specifying values to be assigned ... Read More

In MySQL, without having BOOLEAN data type how can we show TRUE and FALSE values?

Sharon Christine

Sharon Christine

Updated on 20-Jun-2020 13:23:30

209 Views

As we know that there is no BOOLEAN data type in MySQL hence by using TRUE or true, FALSE or false we can enter Boolean values in MySQL statement.Examplemysql> Select TRUE, FALSE; +------+-------+ | TRUE | FALSE | +------+-------+ |    1 |     0 | +------+-------+ 1 row ... Read More

How can we split the name string into three parts by using MySQL SUBSTRING_INDEX() function?

Sharon Christine

Sharon Christine

Updated on 20-Jun-2020 11:49:23

287 Views

To make it understand, we are using the following data from a table named ‘customerdetail’.mysql> Select * from Customerdetail; +----------------------+----------------------+----------+---------------------+ | Name                 | FName                | Address  | Emailid             | ... Read More

How can I eradicate some specific suffix or prefix or both from a MySQL string?

Sharon Christine

Sharon Christine

Updated on 20-Jun-2020 10:32:21

354 Views

MySQL TRIM() function is used to eradicate a specific suffix or prefix or both from the string. The working of TRIM() function can be understood with the help of its syntaxSyntaxTRIM([{BOTH | LEADING | TRAILING} [str_to_remove] FROM] string)Here,  The argument BOTH means the prefixes from both left and right to ... Read More

Advertisements