wilded
3/8/2018 - 10:39 AM

Basic MySQL Commands (command line / Terminal)

Tools to help with queries:

  • Sequel Pro
  • Querious
  • Navicat
show databases; // Shows all databases
use db_name; //Moves into a database
show tables; // Shows all tablse of current database
create table tbl_name (id integer PRIMARY_KEY AUTO_INCREMENT, column1_name type NULL/NOT NULL, columnN_name type NULL/NOT NULL); //Creates a table with columns
describe todos; //Prints the table with details
insert into tblName (col1, colN) values ('valCol1', 'valColN'); // Inserts values into a table
select * from tblName; // Prints the selection from the database
select colName1, colNameN from tblName WHERE colName = 'value' //Prints the selection with a where clause