Posted by: tonyteaching | January 24, 2009

Starting to Create Database and Table in MySQL

Let’s create a database using MySQL command line (I prefer this instead of GUI since we will practice our SQL syntax more)

1. to create database names “smsegov”:

CREATE DATABASE smsegov;

to check whether we have succeeded to create this database or not

SHOW DATABASES;

2. To use a particular database (‘smsegov’)

use smsegov;

use command is used when you have more than one database on a MySQL server and need to switch between them.

3. Now, create the table names ‘survey1’

CREATE TABLE survey1 (

id int auto_increment,

sex text

);

To close MySQL command line, type QUIT


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Categories

%d bloggers like this: