/ (除算) (Transact-SQL)/ (Division) (Transact-SQL)
適用対象:Applies to: SQL ServerSQL Server (サポートされているすべてのバージョン)
SQL ServerSQL Server (all supported versions)
Azure SQL データベースAzure SQL Database
Azure SQL データベースAzure SQL Database
Azure SQL Managed InstanceAzure SQL Managed Instance
Azure SQL Managed InstanceAzure SQL Managed Instance
Azure Synapse AnalyticsAzure Synapse Analytics
Azure Synapse AnalyticsAzure Synapse Analytics
Parallel Data WarehouseParallel Data Warehouse
Parallel Data WarehouseParallel Data Warehouse
SQL ServerSQL Server (サポートされているすべてのバージョン)
SQL ServerSQL Server (all supported versions)
Azure SQL データベースAzure SQL Database
Azure SQL データベースAzure SQL Database
Azure SQL Managed InstanceAzure SQL Managed Instance
Azure SQL Managed InstanceAzure SQL Managed Instance
Azure Synapse AnalyticsAzure Synapse Analytics
Azure Synapse AnalyticsAzure Synapse Analytics
Parallel Data WarehouseParallel Data Warehouse
Parallel Data WarehouseParallel Data Warehouse
1 つの値を別の値で除算します (算術除算演算子)。Divides one number by another (an arithmetic division operator).
Transact-SQL 構文表記規則
Transact-SQL Syntax Conventions
構文Syntax
dividend / divisor
注意
SQL Server 2014 以前の Transact-SQL 構文を確認するには、以前のバージョンのドキュメントを参照してください。To view Transact-SQL syntax for SQL Server 2014 and earlier, see Previous versions documentation.
引数Arguments
dividenddividend
除算される数値式です。Is the numeric expression to divide. dividend には、数値型に分類されるデータ型を持つ有効な 式を指定できます。ただし、datetime および smalldatetime データ型は除きます。dividend can be any valid expression of any one of the data types of the numeric data type category, except the datetime and smalldatetime data types.
divisordivisor
被除数を除算する数値式です。Is the numeric expression by which to divide the dividend. divisor には、数値型に分類されるデータ型を持つ有効な式を指定できます。ただし、datetime および smalldatetime データ型は除きます。divisor can be any valid expression of any one of the data types of the numeric data type category, except the datetime and smalldatetime data types.
戻り値の型Result Types
優先順位が高い引数のデータ型を返します。Returns the data type of the argument with the higher precedence. 詳細については、「データ型の優先順位 (Transact-SQL)」を参照してください。For more information, see Data Type Precedence (Transact-SQL).
整数型の dividend を整数型の divisor で除算すると、結果は小数部が切り捨てられた整数になります。If an integer dividend is divided by an integer divisor, the result is an integer that has any fractional part of the result truncated.
解説Remarks
/ 演算子で返される実際の値は、1 番目の式を 2 番目の式で除算して得られる商です。The actual value returned by the / operator is the quotient of the first expression divided by the second expression.
例Examples
次の例では、算術除算演算子を使用して、Adventure Works CyclesAdventure Works Cycles の販売員の各月の販売目標を計算しています。The following example uses the division arithmetic operator to calculate the sales target per month for the sales people at Adventure Works CyclesAdventure Works Cycles.
-- Uses AdventureWorks
SELECT s.BusinessEntityID AS SalesPersonID, FirstName, LastName, SalesQuota, SalesQuota/12 AS 'Sales Target Per Month'
FROM Sales.SalesPerson AS s
JOIN HumanResources.Employee AS e
ON s.BusinessEntityID = e.BusinessEntityID
JOIN Person.Person AS p
ON e.BusinessEntityID = p.BusinessEntityID;
次に結果セットの一部を示します。Here is a partial result set.
SalesPersonID FirstName LastName SalesQuota Sales Target Per Month
------------- ------------ ----------------- ----------- ------------------
274 Stephen Jiang NULL NULL
275 Michael Blythe 300000.00 25000.00
276 Linda Mitchell 250000.00 20833.3333
277 Jillian Carson 250000.00 20833.3333
例: Azure Synapse AnalyticsAzure Synapse Analytics、Parallel Data WarehouseParallel Data WarehouseExamples: Azure Synapse AnalyticsAzure Synapse Analytics and Parallel Data WarehouseParallel Data Warehouse
次の例では、除算算術演算子を使用して、各従業員の休暇時間と病気時間の単純な比率を計算します。The following example uses the division arithmetic operator to calculate a simple ratio of each employees' vacation hours to sick hours.
-- Uses AdventureWorks
SELECT FirstName, LastName, VacationHours/SickLeaveHours AS PersonalTimeRatio
FROM DimEmployee;
参照See Also
データ型 (Transact-SQL) Data Types (Transact-SQL)
組み込み関数 (Transact-SQL) Built-in Functions (Transact-SQL)
演算子 (Transact-SQL) Operators (Transact-SQL)
SELECT (Transact-SQL) SELECT (Transact-SQL)
WHERE (Transact-SQL) WHERE (Transact-SQL)
/= (除算代入) (Transact-SQL) /= (Division Assignment) (Transact-SQL)
複合演算子 (Transact-SQL)Compound Operators (Transact-SQL)