AddTables_pgsAdmin1.htm |
Ref: pgAdminIII
|
Objectives :
|
Location of pgAdminIII Click On the exe file: Connect to database Login pwd postgre_manas9 Right click on the PostgreSQL-version(localhost:5432) You may create a database : Expand the tree, to add a table in this database, right click on the table objectt. |
The data types serial and
bigserial are not true types, but merely a notational convenience
for creating unique identifier columns (similar to the
AUTO_INCREMENT property supported by some other
databases). In the current implementation, specifying:CREATE TABLE tablename ( colname SERIAL ); is equivalent to specifying: CREATE SEQUENCE tablename_colname_seq; CREATE TABLE tablename ( colname integer NOT NULL DEFAULT nextval('tablename_colname_seq') ); ALTER SEQUENCE tablename_colname_seq OWNED BY tablename.colname; Thus, we have created an integer column and arranged for its default values to be assigned from a sequence generator. A NOT NULL constraint is applied to ensure that a null value cannot be inserted. (In most cases you would also want to attach a UNIQUE or PRIMARY KEY constraint to prevent duplicate values from being inserted by accident, but this is not automatic.) Lastly, the sequence is marked as "owned by" the column, so that it will be dropped if the column or table is dropped.
|
Creating Constraint |
SQL code : -- Table: "pgsEmp1" |
Dropping and adding new column before entering the data
Deleting a column , note column name "manas"deleted. Adding columns |
You may Delete an object like table using this GUI. The image
below shows that a table "pgsEmp1" was dropped and replaced with a new
table with primary key CREATE TABLE emp1 Click On view all rows
Note the view of the table emp1, when you are creating the table, "serial" data type will add the integer value as auto increment , and you don't have to manually type it. |
Start entering the data, and then click on save image
Code: pdo_pgsql3.txt |