For the needs of the contemporary dynamic web applications database
access availability is mandatory. With a database powering your website
at hand, you can make it much more dynamic, content rich and informative. And when it comes to the highest level of software security and stability, the answer is PostgreSQL
The PostgreSQL server
is an open source enterprise class solution allowing the creation of huge databases and offering functionalities and characteristics available only in the expensive corporate SQL
servers (Oracle, MsSQL
, etc.). Based on the highly popular Ingres database software, PostgreSQL is one of the most secure and stable open-source databases. A proof for its stability and reliability is the fact that PostgreSQL databases are currently used by several major companies, like Yahoo, IMDB and Skype.
Table of contents :
Databases with PostgreSQL
In order to have a website, which operates with information, the most common approach is to store this information into a database. The database software tools will store this information securely and safely, ready to display it if requested. Consider a normal forum - all of the posts, and all the information for the different users, are stored in respective databases. This also gives you a serious advantage in the backend of the website - the code powering it can be a lot simple, with just several database queries
to fetch all the needed information.
Just as the name "database software" suggests, PostgreSQL is designed to handle and operate with databases. A database consists of tables
, which are designed to store information. A table in a database, just like a graphical table, is composed of
columns and rows
, with the columns designating the type of information stored in them, and the rows containing the actual information.
How to create databases in PostgreSQL via the command line
There are several ways to create a database in PostgreSQL
. One of the simplest is via the PostgreSQL command line. In there, you simply have to type the "CREATE DATABASE" command and specify the database name. Have in mind that you must be in "SUPERUSER" mode in order to create new databases from the command line.
An example of how to Create Database in PostgreSQL
CREATE DATABASE mydatabasename
Once you have created the database, you can go on and add tables to it, where you can store the needed information. This can also be very easily done via the command line.
An example of How to Create a Table in PostgreSQL
CREATE TABLE phonebook(phone VARCHAR(32), firstname VARCHAR(32), lastname VARCHAR(32), address VARCHAR(64));
The command above will create a table named "phonebook" with four columns to store the information - phone, firstname, lastname and address.
If you no longer need this table, you can simply delete it.
An example of How to Drop a Table in PostgreSQL
You can also drop the whole database, if you decide that you don't need it any more. The syntax for this is very similar to the one for deleting a table.
An example of how to Delete Database in PostgreSQL
DROP DATABASE mydatabasename
How to create databases in PosgreSQL via the Web Hosting Control Panel
If you prefer a more graphical interface for database creation, you should check out NTC Hosting's Web Hosting Control Panel
. In it, you can use the PostgreSQL Databases menu to easily create a new database in just a few simple steps.
All that you need to do is simply specify the database name and password. Then click on the "Add PgSQL Database" button to create the new database.
Once created, you can easily manage the database with the help of the phpPgAdmin
software. To access it, all you need to do is click the icon next to the database name.
Once inside the phpPgAdmin, you can easily manage your database, create tables and fill them with the needed information. There will be no need to wait until the database is available - as soon as you create it, you can start managing it.
PostgreSQL with NTC Hosting
To meet the needs of its clients, NTC Hosting offers PostgreSQL with its Plus
plans, and as an optional service for the rest. All of the web servers
are specially optimized to support PostgreSQL in order to provide the clients with all the tools necessary to have and maintain a website
of the highest quality.