Yahoo Poland Wyszukiwanie w Internecie

Search results

  1. Turn the EXISTS clause into a subquery instead within an IF function. SELECT IF( EXISTS( SELECT * FROM gdata_calendars WHERE `group` = ? AND id = ?), 1, 0) In fact, booleans are returned as 1 or 0. SELECT EXISTS( SELECT * FROM gdata_calendars WHERE `group` = ? AND id = ?)

  2. SELECT table_schema DB,table_name TBL, index_name NDX,seq_in_index NDXPOS FROM information_schema.statistics WHERE column_name = 'Column_Name_I_Want' AND table_schema NOT IN ('information_schema','mysql','performance_schema');

  3. 26 sty 2024 · Use a SELECT statement with a conditional function and your criteria: SELECT IF(COUNT(*) > 0, 'True', 'False') FROM my_table WHERE my_condition; Notes: The query will return ‘True’ or ‘False’ depending on the existence of the row. Using Joins

  4. SELECT id, IF(type = 'P', amount, amount * -1) as amount FROM report See https://dev.mysql.com/doc/refman/8.0/en/flow-control-functions.html. Additionally, you could handle when the condition is null. In the case of a null amount: SELECT id, IF(type = 'P', IFNULL(amount,0), IFNULL(amount,0) * -1) as amount FROM report

  5. The EXISTS operator is used to test for the existence of any record in a subquery. The EXISTS operator returns TRUE if the subquery returns one or more records. Below is a selection from the "Products" table in the Northwind sample database: And a selection from the "Suppliers" table:

  6. 3 sty 2023 · Sometimes, we wish to check the existence of a particular value in a table and alter our output based on the existence of that condition. The syntax for this operation is as follows: SELECT IF ( EXISTS ( SELECT column_name FROM table_name WHERE condition), 1 , 0 )

  7. 28 maj 2024 · We can use either a CASE statement or an IIF () function to implement IF-THEN logic in SQL. In this tutorial, we’ll explore how to implement IF-THEN logic in SQL across various dialects such as SQL Server, MySQL, and PostgreSQL. 2. Using CASE. The CASE statement acts as a logical IF-THEN-ELSE conditional statement.