- 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
MySQL query to select all the records only from a specific column of a table with multiple columns
To fetch records from a specific column, use the following syntax. Just select that specific column for which you want the records −
select yourColumnName from yourTableName;
Let us first create a table −
mysql> create table DemoTable ( Id int NOT NULL AUTO_INCREMENT PRIMARY KEY, Score int ); Query OK, 0 rows affected (0.64 sec)
Insert some records in the table using insert command −
mysql> insert into DemoTable(Score) values(89); Query OK, 1 row affected (0.13 sec) mysql> insert into DemoTable(Score) values(99); Query OK, 1 row affected (0.09 sec) mysql> insert into DemoTable(Score) values(78); Query OK, 1 row affected (0.11 sec) mysql> insert into DemoTable(Score) values(75); Query OK, 1 row affected (0.09 sec)
Display all records from the table using select statement −
mysql> select *from DemoTable;
This will produce the following output −
+----+-------+ | Id | Score | +----+-------+ | 1 | 89 | | 2 | 99 | | 3 | 78 | | 4 | 75 | +----+-------+ 4 rows in set (0.00 sec)
Following is the query to select all the records from a specific column −
mysql> select Score from DemoTable;
This will produce the following output −
+-------+ | Score | +-------+ | 89 | | 99 | | 78 | | 75 | +-------+ 4 rows in set (0.00 sec)
- Related Articles
- MySQL query to select records beginning from a specific id
- MySQL query to display records from a table filtered using LIKE with multiple words?
- How to select all the records except a row with certain id from a MySQL table?
- A single MySQL query to update only specific records in a range without updating the entire column
- MySQL query to copy records from one table to another with different columns
- How to get a specific column record from SELECT query in MySQL?
- MySQL query to select records from a table on the basis of a particular month number?
- MySQL query to display the count of distinct records from a column with duplicate records
- MySQL query to select average from distinct column of table?
- MySQL SELECT query to return records with specific month and year
- Select the table name as a column in a UNION select query with MySQL?
- MySQL query to select records with a particular date?
- Set all the columns of a MySQL table to a particular value with a single query
- MySQL query to select everything to left of last space in a column with name records
- A single MySQL query to insert records (not all) in the second table from the first table

Advertisements