9 月 222023
 

Source: Comparison Functions in MySQL

Overview

Comparison Functions in MySQL are built-in functions that help us to compare a value from one column to any other value(s) from another column. The query then returns a result set based on the given comparison. Some of the Comparison Functions / Operators in MySQL are: IFNULL(), NULLIF(), COALESCE(), LIKE Operator, REGEXP Operator, IN Operator, BETWEEN Operator, GREATEST() and LEAST().

Continue reading »
9 月 222023
 

Source: Comparison Operators in MySQL

Overview

In MySQL, comparison operators are used to compare values and return a boolean result, which can be either true or false. These operators are often used in conjunction with the WHERE clause of a SQL statement to filter rows based on specific criteria. Let's see further in this article about Comparison operators in MySQL.

Continue reading »
9 月 222023
 

Source: Logical Operators in MySQL

Overview

The logical operators in MySQL are used to join numerous conditions in a WHERE clause to filter data from a table. MySQL's three logical operators are AND, OR, and NOT. Only when both conditions are true does the AND operator return a record, whereas the OR operator returns a record if at least one of the conditions is true? The NOT operator negates a condition. To build the conditions, logical operators are typically combined with comparison operators such as =, >, and LIKE.

Continue reading »
9 月 202023
 

Source: Arithmetic Operators in MySQL

Overview

Arithmetic operators in MySQL operators can be used with numeric operands to perform mathematical operations in SQL queries. MySQL supports standard arithmetic operators such as addition (+), subtraction (-), multiplication (*), division (/), and modulus (%). In addition to these basic arithmetic operators, MySQL also provides a few more specialized functions. These operators and functions are essential for performing calculations and manipulating numerical data in MySQL databases. We'll read and learn more about arithmetic operators in this article.

Continue reading »
9 月 202023
 
sudo apt install mysql-server mysql-client

sudo perl -pi.bak -e 's/^bind-address\s*=\s*127.0.0.1/bind-address = 0.0.0.0/' /etc/mysql/mysql.conf.d/mysqld.cnf
sudo systemctl restart mysql

sudo mysql

CREATE DATABASE DB_NAME;
CREATE USER 'USER_NAME'@'%' IDENTIFIED WITH mysql_native_password BY 'PASSWORD';
GRANT ALL PRIVILEGES ON DB_NAME.* TO 'USER_NAME'@'%';
exit
4 月 202023
 

Source: Do different databases use different name quote?

The standard SQL language uses double-quotes for delimited identifiers:

SELECT * FROM "my table";

MySQL uses back-quotes by default. MySQL can use standard double-quotes:

SELECT * FROM `my table`;
SET SQL_MODE=ANSI_QUOTES;
SELECT * FROM "my table";

Microsoft SQL Server and Sybase uses brackets by default. They can both use standard double-quotes this way:

SELECT * FROM [my table];
SET QUOTED_IDENTIFIER ON;
SELECT * FROM "my table";
Continue reading »
2 月 192021
 

Source: Begin Transaction 會不會影響 SQL Performance?

今天同事剛好問我這個問題,這個問題很有趣,也被很多人討論過。 首先,我們需要了解到 MS SQL的Default是Auto Commit,意思就是說縱使你沒有Commit Transaction,你的交易還是會被自動Commit。這點和Oracle不太一樣,算是MS SQL的特色之一(?)

Continue reading »