Familiar with PostgreSQL Database

On numerous occasions to discuss about database connections using PHP, MySQL always relate it to. No wonder because the MySQL database server is one of the very popular open source.But did you know that in addition there is also a MySQL database server that is also another popular open source and PostgreSQL? Well, this time on programming tutorial will raise discussion about PostgreSQL.If PostgreSQL was about to be compared with MySQL, of course, each has advantages and disadvantages. Because both have their fans so of course it is very difficult to determine which one is better. (An analogy can be drawn is the world of football, for example, where a more intense Juventus or Milan, Pele or Maradona, Zidane or Nedved). However, comparison of the two will try to provide as objective as possible.The advantages of MySQL is more "light" and fast. A variety of administration tools is also provided a fairly complete, such as mysqladmin example. Web servers that support the use of MySQL is also relatively more (especially the free ones). Shortage of MySQL is not supporting the existence of foreign keys, stored procedures, transaction, rollback, and subselect. MySQL also does not have a trigger.Well, it easily can be concluded that the advantages and disadvantages of PostgreSQL is the opposite of MySQL. Though PostgreSQL is slower than MySQL, but can handle a heavier workload, also supported the existence of foreign keys, stored procedures, transaction, rollback, subselect, and triggers.So choose where, PostgreSQL or MySQL? Depending on your needs. If you need a database used for "light" such as storing and displaying data only - if any of its data processing is simple as well - then MySQL is the right choice. Moreover, many free web servers that provide it. But if you build an application that requires a database that is "really" are RDBMS, you must be settled on PostgreSQL, for example in building applications "heavy" like banking, simulating a natural phenomenon, accounting in large companies, and others.In this tutorial using RedHat 9.0 and during installation choose to install PostgreSQL has, so to use PostgreSQL do not need to do additional settings. For those of you who do not use RedHat 9.0 and was not found on your system PostgreSQL, then you must install it yourself. To obtain the distribution of its installation, you can download it from www.postgresql.org. Advice, find one that has the rpm format for easy installation stage.Once PostgreSQL is installed, there are some settings you should do before you can use. 
The steps are as follows:
• Create a user account specifically for PostgreSQL administration, usually the name of the user account is "postgres".
• Login with user "postgres".
• Create a cluster database with the following command: $ Initdb-D / usr / local / pgsql / data (/ usr / local / pgsql / data directory is prepared for PostgreSQL data).
• Starting the database server with the command: $ Postmaster-D / usr / local / pgsql / dataFor more on this you can refer to the PostgreSQL documentation.
Frankly could not give further details because of the use RedHat 9.0 with no additional settings need to be done. But it must be remembered, PostgreSQL server should be run at boot time.To be able to use PostgreSQL, first login as root. In the shell to change your user postgres user with the command:
# Su postgres
By doing this command you will be brought to the shell like this:
bash-2.05b $
This shell of a variety of work with PostgreSQL will be done.
Creating a databaseTo create a database, the command is:createdb namaDatabaseExample:
bash-2.05b $ createdb try
CREATE DATABASE
bash-2.05b $
If successful, then PostgreSQL will display the "CREATE DATABASE" and returned to the shell.
Accessing the databaseTo access the database, the command is:psql [options] namaDatabaseExample:
bash-2.05b $ psql-s trialWelcome to psql 7.3.2, the PostgreSQL interactive terminal.
 
Type: \ copyright for distribution terms
       
\ H for help with SQL commands
       
\? for help on internal slash commands
       
\ G or terminate with semicolon to execute query
       
\ Q to quit
 
try = #If you've got here, it means you are ready for further work with PostgreSQL. To find out the SQL commands supported by PostgreSQL, type \ h. To know the internal commands, type \?. To run the following SQL commands typed, use the \ g or to end the command with a semicolon (;) as in MySQL. To end the PostgreSQL type \ q. Each command in PostgreSQL was preceded by a backslash character (\).Deleting a databaseTo delete a database command is as follows:dropdb namaDatabaseKeep in mind, do this command with extreme caution, because the database who have been removed can not be returned.
Familiar with PostgreSQL Database Familiar with PostgreSQL Database Reviewed by sarindi on 3:27 AM Rating: 5

No comments:

Powered by Blogger.