Skip to Content
Learning Linux Shell Scripting - Second Edition
book

Learning Linux Shell Scripting - Second Edition

by Ganesh Sanjiv Naik
May 2018
Beginner
332 pages
7h 28m
English
Packt Publishing
Content preview from Learning Linux Shell Scripting - Second Edition

Describing a table

If we need to know more about the overall information or query the execution plan of an entire table, we need to use the DESCRIBE command.

We will create the script mysql_12.sh to obtain the table structure:

#!/bin/bash 
mysql -u user1 -pTest623@!  <<MY_QUERY 
use testdb; 
desc Authors; 
MY_QUERY 

Save the script and run it as follows:

          $ chmod +x mysql_12.sh
          $ ./mysql_12.sh
  

The output will be:

    Field Type  Null  Key   Default           Extra
    Id    int(11)     NO    PRI   NULL  auto_increment
    Name  varchar(25) YES   NULL  
    ADDRESS varchar(25)     YES   NULL
  
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Learning Linux Shell Scripting

Learning Linux Shell Scripting

Ganesh Sanjiv Naik
Linux Shell Scripting Cookbook - Third Edition

Linux Shell Scripting Cookbook - Third Edition

Clif Flynt, Sarath Lakshman, Shantanu Tushar

Publisher Resources

ISBN: 9781788993197Supplemental Content