This blog post will show some common MySQL commands.
Create a database.
CREATE DATABASE example;
List all databases on the server.
SHOW DATABASES;
Use a specified database.
USE example;
Delete a specified database.
DROP DATABASE example;
List all tables in a database.
SHOW TABLES;
Create a simple table.
CREATE TABLE employees (
id INT,
name VARCHAR(64)
);
Create a table with an auto incrementing numeric key.
CREATE TABLE employees (
id INT PRIMARY KEY AUTO_INCREMENT,
name VARCHAR(64)
);
Select a row from a table.
SELECT name FROM employees WHERE id = 3;
Insert a row into a table.
INSERT INTO employees VALUES (1, 'David');
Update a row in a table.
UPDATE employees SET name = 'John' WHERE id = 2;
Delete a row from a table.
DELETE FROM employees WHERE id = 1;
