Showing posts with label mysql. Show all posts
Showing posts with label mysql. Show all posts

MySQL Workflow Basic Tutorial Getting Started

This is very basic mysql tutorial for the people who need to remember the workflow.

Create Database

CREATE DATABASE name_of_the_database;

Show Databases

SHOW DATABASES;

Drop Database

DROP DATABASE database name;

Open Specific Database

USE name_of_database;

Show Available Tables in Databases

SHOW tables;

Create Tabele

CREATE TABLE tablename(id INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
name VARCHAR(20),
food VARCHAR(30),
confirmed CHAR(1),
signup_date DATE);

View Table Structure

DESCRIBE name_of_the_table;

Insert information or data into the mysql

INSERT INTO `potluck` (`id`,`name`,`food`,`confirmed`,`signup_date`) VALUES (NULL, "John", "Casserole","Y", '2012-04-11');

View table Data

SELECT * FROM tablename;

Update table

UPDATE tablename;

How to Add and Delete a Column

ALTER TABLE table_name DROP column_name;

ALTER TABLE table_name ADD column_name;

How to Delete a Row

DELETE from [table name] where [column name]=[field text];