COP 4710 INFORMATION STORAGE RETRIEVAL CONNECT TO POSTGRESQL
- Slides: 20
COP 4710 INFORMATION STORAGE & RETRIEVAL CONNECT TO POSTGRESQL SERVER VIA PGADMIN Prepared for Prof. JAI NAVLAKHA By Hsin-Yu Ha
PROCEDURE OUTLINE Download pg. Admin from http: //www. pgadmin. org/ Install pg. Admin Connect to Postgre. SQL through pg. Admin Start creating your own database. Spring 2019: Download pgadmin 4 v 1. 6 [Look at given instructions]
DOWNLOAD PGADMIN (1) Go to Pg. Admin Website Click download
DOWNLOAD PGADMIN (4) – V 1. 6 [NOT V 1. 12. 3] Select the latest reliable version v 1. 12. 3
DOWNLOAD PGADMIN (4)
DOWNLOAD PGADMIN (4) Download pgadmin 4 v 1. 6. zip
INSTALL PGADMIN (1) After extracting the zip file “pgadmin 3 -1. 12. 3. zip” , execute the file pgadmin 3. msi and start the installation process.
INSTALL PGADMIN (2)
INSTALL PGADMIN (3)
INSTALL PGADMIN (4) The installation is successfully finished
CONNECT TO POSTGRESQL (1) Open pg. Admin and add a connection to a server
CONNECT TO POSTGRESQL (2) Name for server connection: cop 4710 Host server: cop 4710 -postgresql. cs. fiu. edu Database Name: spr 20_FIUusername Username: spr 20_FIUusername Password: Panther ID
CREATE A DATABASE (1) Create table CREATE TABLE products ( product_no integer PRIMARY KEY, name text NOT NULL, price numeric ); Constraints: (1) NOT NULL (2) UNIQUE (3) CHECK Boolean expression For instance CHECK (price>0) (4) PRIMARY KEY (5) FOREIGN KEY Primary key and Foreign key CREATE TABLE order_items ( product_no integer REFERENCES products, order_id integer REFERENCES orders, quantity integer, PRIMARY KEY (product_no, order_id), CONSTRAINT cq CHECK (quantity > 5) );
CREATE A DATABASE (2) Foreign Key CREATE TABLE other_table ( c 1 integer PRIMARY KEY, c 2 integer ); CREATE TABLE t 1 ( a integer PRIMARY KEY, b integer, c integer, FOREIGN KEY (b, c) REFERENCES other_table (c 1, c 2) );
CREATE A DATABASE (3) CREATE TABLE products ( product_no integer PRIMARY KEY, name text, price numeric ); CREATE TABLE orders( order_id integer PRIMARY KEY, shipping_address text, … ); CREATE TABLE order_items ( product_no integer REFERENCES products ON DELETE RESTRICT, order_id integer REFERENCES orders ON DELETE CASCADE, quantity integer, PRIMARY KEY (product_no, order_id) );
CREATE A DATABASE (4) Insert Data INSERT INTO products (product_no , name , price) VALUES (1, 'cheese', 5); INSERT INTO products VALUES (1, 'cheese', 5), (2, ’cake’, 10) ;
CREATE A DATABASE (5) Import Data COPY country FROM '/usr 1/proj/bray/sql/country_data. csv' WITH DELIMITER ', ' ; Export Data COPY country TO '/sql/country_data. csv' WITH DELIMITER '|';
CREATE A DATABASE (6) ALTER Table Add columns ALTER TABLE products ADD COLUMN description text; Remove columns ALTER TABLE products DROP COLUMN description; Add constraints ALTER TABLE products ADD CONSTRAINT namecheck CHECK (name <> ''); ALTER TABLE products ADD CONSTRAINT some_name UNIQUE (product_no); ALTER TABLE products ADD FOREIGN KEY (product_group_id) REFERENCES product_groups; ALTER TABLE products ALTER COLUMN product_no SET NOT NULL;
CREATE A DATABASE (7) ALTER Table Remove constraints ALTER TABLE products DROP CONSTRAINT some_name; ALTER TABLE products ALTER COLUMN product_no DROP NOT NULL; Change column data types ALTER TABLE products ALTER COLUMN price TYPE numeric(10, 2); Rename columns ALTER TABLE products RENAME COLUMN product_no TO product_number; Rename tables ALTER TABLE products RENAME TO items;
CREATE A DATABASE (8) Delete Data DELETE FROM products WHERE price = 10; DELETE FROM products
- Cop 4710
- Cop 4710 ucf
- Cop4710
- Cop 4710 ucf
- Good cop bad cop interrogation
- Cop 1 cop 2
- Cop connect
- Gullas bills
- Storage and retrieval technologies in multimedia
- Encoding storage and retrieval
- Long term storage and retrieval
- Long term storage and retrieval
- Grafana postgresql variables
- Labview postgresql
- Postgresql range partition
- Postgres bdr download
- Xbase++ postgresql
- Posgre
- Postgresql multi-master
- Pg_try_advisory_xact_lock
- Postgresql pragma autonomous_transaction