- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How do I SELECT none of the rows and columns in MySQL?
To display none of the rows and columns, use SELECT NULL and FALSE as in the below syntax −
select null from yourTableName where false;
Let us first create a table −
mysql> create table DemoTable1367 -> ( -> Id int NOT NULL AUTO_INCREMENT PRIMARY KEY, -> FirstName varchar(20) -> ); Query OK, 0 rows affected (0.55 sec)
Insert some records in the table using insert command −
mysql> insert into DemoTable1367(FirstName) values('Chris'); Query OK, 1 row affected (0.20 sec) mysql> insert into DemoTable1367(FirstName) values('David'); Query OK, 1 row affected (0.10 sec) mysql> insert into DemoTable1367(FirstName) values('Bob'); Query OK, 1 row affected (0.10 sec)
Display all records from the table using select statement −
mysql> select * from DemoTable1367;
This will produce the following output −
+----+-----------+ | Id | FirstName | +----+-----------+ | 1 | Chris | | 2 | David | | 3 | Bob | +----+-----------+ 3 rows in set (0.00 sec)
Following is the query to select none of the rows and columns −
mysql> select null from DemoTable1367 where false;
This will produce the following output. Empty set is visible since we have selected none of the rows and columns −
Empty set (0.00 sec)
- Related Articles
- How do I select 5 random rows from the 20 most recent rows in MySQL?
- MySQL Select Rows where two columns do not have the same value?
- How do I lag columns in MySQL?
- How do I delete blank rows in MySQL?
- How select specific rows in MySQL?
- How do I list all the columns in a MySQL table?
- Python Pandas - Select a subset of rows and columns combined
- Select all duplicate MySQL rows based on one or two columns?
- How to select MySQL rows in the order of IN clause?
- How can I select rows which fall on a specific day of week in MySQL?
- How to select last two rows in MySQL?
- SELECT MySQL rows where today's date is between two DATE columns?
- How to select the table with the greatest number of columns in MySQL?
- How to multiply a matrix columns and rows with the same matrix rows and columns in R?
- Select aggregate function and all other columns in MySQL

Advertisements