# Tutorial 2: Create Tables manually

Attention: The table format changed in version 0.1.3-Alpha-02 and 0.1.5-Alpha-01!

If you don't want to create new Tables with a CREATE TABLE call you can also create a table file on your own.

## 1. Create a Text File

Create a File with the Extension .txt

## 2. Define the columns (first line of the file)

In the first line of the text files, you have to write all column name.
Each column-name is finished with a #.

Example:

    Nr#Name#Prename#Adress#Age

## 3. Define Data-type's (second line of the file)

Using the same format as above, you have to define the data type of each column now.
The supported datatypes are listed here.

Example for the second line::

    inc#str#str#str#int

## 4. Define Default Values (third line of the file)

Using the same format as above, you have to define the default value for each column now.
The default values are used if you don't specify all columns when using an INSERT Statement.

Example for the third line::

    0#default name#default prename#no adress#40

## 5. (Voluntary) Insert Data

Using the same format again, you can now insert some data in your table.
The finished table-text-file could look like this:

    Nr#Name#Prename#Adress#Age
    inc#str#str#str#int
    0#default name#default prename#no adress#40
    0#Tom#Smith#Teststreet 9#40
    1#Max#Payne#Superstreet 1#22

## 6. Set permissions

Once you have uploaded the Text-File on your webserver, you have to change the permissions for it.
This can be done with most FTP client. You could use a chmod 777 for example.
To make it impossible that the Text-File can be viewed from the brower directly, it's m recommendable to
change the .htaccess File in the Folder where the Text-File is located.
Deny GET and POST access for to this folder.

## 7. Hints

If you want to use % or # as part of a column name or value, you have to write %p instead of % and %h instead of #.
This is necessary because # and % have a special meaning in table files.
You ONLY have to bother about the # and % characters if you enter the data manually into the text file.
CREATE TABLE and all other SQL Statements will handle this automatically for you.

Examples:

    nr#link
    inc#str
    ##
    1#http://www.abc.de/index.htm%hanchor
    2#http://www.abc.de/start.htm%hanchor2

    nr#person#discount
    inc#str#str
    ##10%p
    1#müller#5%p
    2#maier#7,5%p