
- Learn MySQL
- MySQL - Home
- MySQL - Introduction
- MySQL - Installation
- MySQL - Administration
- MySQL - PHP Syntax
- MySQL - Connection
- MySQL - Create Database
- MySQL - Drop Database
- MySQL - Select Database
- MySQL - Data Types
- MySQL - Create Tables
- MySQL - Drop Tables
- MySQL - Insert Query
- MySQL - Select Query
- MySQL - Where Clause
- MySQL - Update Query
- MySQL - Delete Query
- MySQL - Like Clause
- MySQL - Sorting Results
- MySQL - Using Join
- MySQL - NULL Values
- MySQL - Regexps
- MySQL - Transactions
- MySQL - Alter Command
- MySQL - Indexes
- MySQL - Temporary Tables
- MySQL - Clone Tables
- MySQL - Database Info
- MySQL - Using Sequences
- MySQL - Handling Duplicates
- MySQL - SQL Injection
- MySQL - Database Export
- MySQL - Database Import
What does the slash mean in a MySQL query?
The slash means division ( /) in MySQL query. This can be used to divide two numbers. Here, we will see an example to divide numbers from two columns and display result in a new column.
Let us first create a table −
mysql> create table DemoTable719 ( FirstNumber int, SecondNumber int ); Query OK, 0 rows affected (0.57 sec)
Insert some records in the table using insert command −
mysql> insert into DemoTable719 values(20,10); Query OK, 1 row affected (0.18 sec) mysql> insert into DemoTable719 values(500,50); Query OK, 1 row affected (0.22 sec) mysql> insert into DemoTable719 values(400,20); Query OK, 1 row affected (0.11 sec)
Display all records from the table using select statement −
mysql> select *from DemoTable719;
This will produce the following output -
+-------------+--------------+ | FirstNumber | SecondNumber | +-------------+--------------+ | 20 | 10 | | 500 | 50 | | 400 | 20 | +-------------+--------------+ 3 rows in set (0.00 sec)
Following is the query to perform division with slash in MySQL −
mysql> select *,FirstNumber/SecondNumber AS Result from DemoTable719;
This will produce the following output -
+-------------+--------------+---------+ | FirstNumber | SecondNumber | Result | +-------------+--------------+---------+ | 20 | 10 | 2.0000 | | 500 | 50 | 10.0000 | | 400 | 20 | 20.0000 | +-------------+--------------+---------+ 3 rows in set (0.00 sec)
- Related Articles
- What does the slash(/) in the parameter list of a function mean in Python?
- What does the KEY keyword mean in MySQL?
- What does INT(7) in MySQL mean?
- What does parenthesis mean in MySQL SELECT (COLNAME)?
- What does “unsigned” in MySQL mean and when to use it?
- What does it mean by select 1 from MySQL table?
- Select text after last slash in MySQL?
- What does “?:” mean in a Python regular expression?
- Implement a MySQL Void Query that does nothing
- What does psychology mean?
- What does geometry mean?
- What does humus mean?
- What does the Star operator mean in Python?
- What does the explicit keyword mean in C++?
- What does the restrict keyword mean in C++?

Advertisements