Brinkster Knowledge Base

KB Home   /  Support  /  Control Panel  /   How do I use the Database Manager
How do I use the Database Manager Articles
The database manager uses SQL commands to view data from and make changes to your database. The specific commands may vary slightly between database types. This tutorial is created with MySQL as the database type being used.

Here is a sample showing how to create a table in your database.

CREATE TABLE tablename
(name varchar(50),
age int)



In this sample we use CREATE TABLE and follow it with the table name. Remember this table name so that you can reference it later. The next line shows the first field name which in this case is "name". The next term "varchar", is the type of data. Any value can be entered in the field but it will be stored as text. The number in parenthesis is the maximum size the value in this field can be, in this case 50 characters. The "age" field is set to "int" this is short for integer so the value will be stored as a number.

---------------------------------------------

In most cases once you have created a database you will enter data into it from the site but you can also do this through the Database Manager. In both cases this code will be very similar.

INSERT INTO tablename
(name, age)
VALUES
('Tom', 35)



In this sample we use the command INSERT INTO followed by the table name we want the content to be added to. This will create a new entry into the database with the values specified. The second line shows "(name, age)" meaning that we want to insert values into each of these fields. The order in which these are specified must match the order the values for them are given. The next line "VALUES" is used to show that the following info will be the values you want to enter. The next line ('Tom', 35) shows the values that will be entered. "Tom" will go into the "name" field and "35" will go into the "age" field. In the Database Manager make sure to use single quotes around the values as shown.

---------------------------------------------

This statement will show all of the data in the table that you specify.

 

SELECT * FROM tablename



The " * " in this sample is a wildcard so all values will be pulled.

---------------------------------------------

This statement will show only fields that apply to the rule.

 

SELECT age FROM tablename WHERE name = 'Tom'



This will display the age of anyone in the database named "Tom".

---------------------------------------------

There are many more SQL commands however not all of them are supported in the Database Manager. The other commands can be used through code in your site. To learn more about SQL commands please view the following link.
http://www.w3schools.com/sql/sql_intro.asp

The commands that are supported in the Database Manager are:
SELECT
INSERT
UPDATE
DELETE
CREATE TABLE
DROP TABLE
SIMPLE JOIN