
- 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
Select multiple Book Titles that share the minimum (PRICE) value in MySQL?
For this, use MySQL MIN(). Let us first create a −
mysql> create table DemoTable1414 -> ( -> BookTitle varchar(40), -> BookPrice int -> ); Query OK, 0 rows affected (0.82 sec)
Insert some records in the table using insert −
mysql> insert into DemoTable1414 values('Deep dive using java',560); Query OK, 1 row affected (0.11 sec) mysql> insert into DemoTable1414 values('C++ in depth',360); Query OK, 1 row affected (0.11 sec) mysql> insert into DemoTable1414 values('Data structure in C',590); Query OK, 1 row affected (0.11 sec) mysql> insert into DemoTable1414 values('Algorithm in C++',1090); Query OK, 1 row affected (0.16 sec) mysql> insert into DemoTable1414 values('Java in Depth',360); Query OK, 1 row affected (0.33 sec)
Display all records from the table using select −
mysql> select * from DemoTable1414;
This will produce the following output −
+----------------------+-----------+ | BookTitle | BookPrice | +----------------------+-----------+ | Deep dive using java | 560 | | C++ in depth | 360 | | Data structure in C | 590 | | Algorithm in C++ | 1090 | | Java in Depth | 360 | +----------------------+-----------+ 5 rows in set (0.00 sec)
Following is the query to select multiple book titles that share the minimum price value−
mysql> select BookTitle from DemoTable1414 -> where BookPrice= ( select min(BookPrice) from DemoTable1414);
This will produce the following output −
+---------------+ | BookTitle | +---------------+ | C++ in depth | | Java in Depth | +---------------+ 2 rows in set (0.00 sec)
- Related Articles
- Difference between Book Value and Market Value of a Share
- How to calculate the Book Value of an Ordinary Share?
- MySQL SELECT products WHERE 'average price per product' < value?
- Get the minimum value from a list with multiple columns in MySQL?
- Conditional select between dates in MySQL for maximum and minimum values of price set in a table?
- MySQL query to increase item value price for multiple items in a single query?
- MySQL Select Multiple VALUES?
- How to select row when column must satisfy multiple value in MySQL?
- How to select data in MySQL where a field has a minimum value?
- Select minimum row value from a column with corresponding duplicate column values in MySQL
- MySQL select query with multiple WHERE?
- Select the minimum value from the maximum values of two tables with a single MySQL\nquery?
- How to execute multiple select queries in MySQL ?
- How to select records that begin with a specific value in MySQL?
- What is the process of Book Building and Price Discovery?

Advertisements