Monica Mona has Published 85 Articles

How can we use a combination of logical operators while creating MySQL views?

Monica Mona

Monica Mona

Updated on 22-Jun-2020 13:47:56

99 Views

MySQL views can be created by using a combination of logical operators like AND, OR, and NOT. It can be illustrated with the help of following examples −Examplemysql> Create or Replace View Info AS select ID, Name, Address , Subject FROM Student_info WHERE (Subject = 'Computers' AND ADDRESS = 'Delhi') ... Read More

How can we use SIGNAL statement with MySQL triggers?

Monica Mona

Monica Mona

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

3K+ Views

Actually, MySQL SIGNAL statement is an error handling mechanism for handling unexpected occurrences and a graceful exit from the application if need to be. Basically, it provides error information to the handler. Its basic syntax would be as follows −SIGNAL SQLSTATE | condition_value [SET signal_information_item = value_1, [, signal_information_item] = ... Read More

How can we destroy a trigger?

Monica Mona

Monica Mona

Updated on 22-Jun-2020 12:07:19

292 Views

We can destroy a trigger in two ways −Dropping a trigger explicitlyWith the help of the DROP statement, we can destroy a trigger explicitly. It can be understood with the help of the following example −mysql> DROP Trigger before_inser_studentage1; Query OK, 0 rows affected (0.05 sec)Dropping a trigger implicitlyA trigger ... Read More

How can I use MySQL subquery as a table in FROM clause?

Monica Mona

Monica Mona

Updated on 22-Jun-2020 11:04:04

132 Views

We can use a subquery as a table in the FROM clause in the same way as the result of a subquery can be used with an operator in the WHERE clause. In the following example, we are using the result of subquery as a table by writing it after ... Read More

How MySQL evaluates if we use EXISTS operator with a subquery that returns no rows?

Monica Mona

Monica Mona

Updated on 22-Jun-2020 08:42:56

84 Views

If a subquery, used with EXIST operator, returns no rows, the expression EXIST returns FALSE and MySQL returns the empty set as output. It can be understood with the help of simple example using the following data from table ‘Customers’ −mysql> Select * from Customers; +-------------+----------+ | Customer_Id | Name ... Read More

How can I get the output based on comparison done with column’s name using MySQL IN() function?

Monica Mona

Monica Mona

Updated on 22-Jun-2020 06:38:53

75 Views

In this scenario, we need to use the name of the column as ‘Expression’ which will then be compared with the values in the list. If a column has value/s matched within the list,  the output would be produced. For understanding it, consider the example from employee table having the following data −mysql> ... Read More

How can we fetch a MySQL SET column as a list of integer offset?

Monica Mona

Monica Mona

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

254 Views

We can fetch the MySQL SET column values as a list of integer offset with the help of the MAKE_SET() function. To make it understand, we are creating a table named ‘set_testing’ as follows −mysql> Create table set_testing( id INT UNSIGNED NOT NULL PRIMARY KEY AUTO_INCREMENT, table SET('ABC', 'ABD', 'GHF') ... Read More

What are the default rules used by the parser for parsing names of built-in functions?

Monica Mona

Monica Mona

Updated on 22-Jun-2020 05:53:23

107 Views

Actually, when a parser encounters a word that is the name of a built-in function, it must determine whether the name represents a function call or is instead a non-expression reference to an identifier such as a table or column name. consider the following queries −1. Select sum(salary) from employee; ... Read More

How can we extract the Year and Month from a date in MySQL?

Monica Mona

Monica Mona

Updated on 22-Jun-2020 05:01:52

4K+ Views

It can be done with the following three ways in MySQLBy using EXTRACT() function For extracting YEAR and MONTH collectively then we can use the EXTRACT function. We need to provide the YEAR_MONTH as an argument for this function. To understand it, consider the following function using the data from table ... Read More

In MySQL, which function we can use to find the index position of a particular string from a list of strings?

Monica Mona

Monica Mona

Updated on 20-Jun-2020 08:41:52

531 Views

We can use FIELD() function to find the index position of a particular string from a list of strings.SyntaxFIELD(str search, String1, String2, …StringN)Here, the str search is the string whose index number we want to search and String1, String …StringN is the list of strings from which the search would ... Read More

Advertisements