knowledgediarybd.com

Your Virtual Knowledge Campus







Create Database & Table

Create tableCreate Database & Create Table is an important matter in SQ L.

To access and manipulated data  First of all we have to create a database with a specific name Like: Teacher

with help of “http://localhost/phpmyadmin/ ”

For this first  you have to install ‘Xampp‘ in your local drive C or other drive. Then write  http://localhost/phpmyadmin/  in your browser and you will see the following

interface:


Phpmyadmin

Follow the above indicated instruction for crating  New Database. After Clicking create button you

will  see following  interface:

The above interface give you a massage that your database name “Teacher ” has been created.you can also see Database Creation sql query like: CREATE DATABASE `Teacher` ;

Though  database has been created but there is no table under this Database. For this you have to create table.

Create Table:  The CREATE TABLE command defines each column of the table uniquely. Each Column has a minimum of three attributes, a name, data type and size.

Rules For Creating Tables:

1 .A name can have maximum up to 30 characters.

2. Alphabets from A-Z ,a-z and numbers from 0-9 are allowed.

3. A name should  begin with an alphabet.

4.The use of the special  character like _ is allowed and also recommended

( special  character like: $,# are allowed only in oracle)

How to create  a Table:

We can create a table by following two way.

1. From above interface :

For this you have to  put a Table  Name which I indicated By “student”  with the number of field or column here I put 5  But you can put your required number of field or column. Finally you have to click Go Button.

2. SQ L  query  For Create Table:

 

Purpose: The CREATE TABLE statement is used to create a table in a database.

Syntax:   create table tbl_nm( clm_nm1 data type, clm_nm2 data type,…..)

For Example:

CREATE TABLE `teacher Info` (
`TEACHER_ID` INT NOT NULL ,
`FIRST_NAME` VARCHAR( 20 ) NOT NULL ,
`LAST_NAME` VARCHAR( 20 ) NOT NULL ,
`SALARY` VARCHAR( 20 ) NOT NULL
)
Output of the above query:

Related Post or you may Like:

      


knowledgediarybd.com © 2017
shares