11 Handout Essay

Submitted By mrflex23
Words: 1407
Pages: 6

Introduction to MySQL

Working with Database


Introduction to MySQL



Creating Tables



Altering Tables



Dropping Tables



Queries

• Database can be created in two way:
– Using PHPMyAdmin
– Using SQL command

1 __________________________ 2 _________________________
____________________________ ___________________________
____________________________ ___________________________
____________________________ ___________________________
____________________________ ___________________________
____________________________ ___________________________
____________________________ ___________________________
____________________________ ___________________________
____________________________ ___________________________
Introduction to MySQL

Introduction to MySQL

• Using PHPMyAdmin

• Using SQL command

1. Type the database name and
2. Click the create button

– Syntax:
CREATE {DATABASE | SCHEMA}
[IF NOT EXIST] db_name
[create_specification
[, create_specification]…]
– Create specification:
[DEFAULT] CHARACTER SET charset_name
[DEFAULT] COLLATE collate_name

:
CREATE DATABASE DBLibrary
Example

3 __________________________ 4 _________________________
____________________________ ___________________________
____________________________ ___________________________
____________________________ ___________________________
____________________________ ___________________________
____________________________ ___________________________
____________________________ ___________________________
____________________________ ___________________________
____________________________ ___________________________

Introduction to MySQL

Creating Tables

• Using SQL command

• Database can be DROP in two ways:
– Using PHPMyAdmin

5 __________________________ 6 _________________________
____________________________ ___________________________
____________________________ ___________________________
____________________________ ___________________________
____________________________ ___________________________
____________________________ ___________________________
____________________________ ___________________________
____________________________ ___________________________
____________________________ ___________________________
Creating Tables

Creating Tables

• Database can be DROP in two ways:

• Using PHPMyAdmin

– Using SQL command
• syntax:
DROP {DATABASE | SCHEMA} [IF EXISTS] db_name
Example:
DROP DATABASE DBLibrary

1. Type the table name and the starting number of fields for the table,
2. Click the GO button,
1

2

• Example:

DROP DATABASE DBLibrary

7 __________________________ 8 _________________________
____________________________ ___________________________
____________________________ ___________________________
____________________________ ___________________________
____________________________ ___________________________
____________________________ ___________________________
____________________________ ___________________________
____________________________ ___________________________
____________________________ ___________________________

Creating Tables

Creating Tables

• Using PHPMyAdmin

• Using SQL query command

3. Supply the information to the given fields attributes,
4. Add more fields if necessary and click GO button.
3

3

4

– The create table command is used to create tables inside a database. The CREATE TABLE command has the following syntax: CREATE TABLE <table_name> (
<column_name> <column_type> <column_attribute>,
<column_name> <column_type> <column_attribute>,
<column_name> <column_type> <column_attribute>,

PRIMARY KEY (<column_name>),
INDEX index_name (<column_name>))
TYPE=<table_type>;

9 __________________________ 10 ________________________
____________________________ ___________________________
____________________________ ___________________________
____________________________ ___________________________
____________________________ ___________________________…