Database CLI: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 6: | Line 6: | ||
#<code>>DESCRIBE <name of table>;</code> Prints the structure of a table, eg: <code>DESCRIBE tbl_entity;</code> | #<code>>DESCRIBE <name of table>;</code> Prints the structure of a table, eg: <code>DESCRIBE tbl_entity;</code> | ||
#<code>>SELECT * FROM <name of table>;</code> Prints all records from the named table, eg: <code>SELECT * FROM tbl_entity;</code> | #<code>>SELECT * FROM <name of table>;</code> Prints all records from the named table, eg: <code>SELECT * FROM tbl_entity;</code> | ||
#<code>>SELECT * FROM <name of table> WHERE <condition>;</code> Prints all records from the named table where the condition is met, eg: <code>SELECT * FROM tbl_entity WHERE td LIKE "CE";</code> |
Revision as of 17:25, 7 July 2020
This page contains some helpful commands to use at the MariaDB CLI.
>SHOW DATABASES;
List all databases;>USE <database>;
Use a particular database, eg:>USE bplan;
>SHOW TABLES;
List all tables in a database (after using USE);>DESCRIBE <name of table>;
Prints the structure of a table, eg:DESCRIBE tbl_entity;
>SELECT * FROM <name of table>;
Prints all records from the named table, eg:SELECT * FROM tbl_entity;
>SELECT * FROM <name of table> WHERE <condition>;
Prints all records from the named table where the condition is met, eg:SELECT * FROM tbl_entity WHERE td LIKE "CE";