0

I am accessing mysql from cmd, and I want to get all rows from a specific table, but I can't find the exact command to do so.

Example:

SHOW DATABSES    #shows all available databases;
CONNECT TEST_DB  #I connect to  test_db
SHOW TABLES      #shows all tables.

What Is missing is how to only see the columns from a specific table.

if I do SELECT * FROM table_test it displays all results instead of just the columns

2
  • 1
    Why don't you use DESCRIBE table_test? Commented Mar 31, 2014 at 12:38
  • 1
    @fedorqui Thanks! Answer it to get my vote :) Commented Mar 31, 2014 at 12:40

2 Answers 2

2

You may be looking for:

DESCRIBE table_test;

which is same as

EXPLAIN table_test;

See reference in MySQL - 13.8.1 DESCRIBE Syntax which links to MySQL - 13.8.1 EXPLAIN Syntax.

Sign up to request clarification or add additional context in comments.

1 Comment

Beaten to the punch. +1 - This is the correct answer.
0
  1. Select a database:
    USE YOUR_DB;
  2. To show your tables
    SHOW TABLES;
  3. To show columns and rows of a table
    DESC YOUR_TABLE;
  4. access a specific field
    SELECT YOUR_COLUMN FROM YOUR_TABLE;

1 Comment

As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.