postgres=#
postgres=#
postgres=# CREATE TABLE products (
postgres(# product_no integer,
postgres(# name text,
postgres(# price numeric
postgres(# );
CREATE TABLE
postgres=#
postgres=# INSERT INTO products (product_no, name, price) VALUES (1, 'Java', 1234);
INSERT 0 1
postgres=# INSERT INTO products (product_no, name, price) VALUES (2, 'SQL Server', 3421);
INSERT 0 1
postgres=# INSERT INTO products (product_no, name, price) VALUES (3, 'Oracle', 7623);
INSERT 0 1
postgres=# INSERT INTO products (product_no, name, price) VALUES (4, 'DB2', 9874);
INSERT 0 1
postgres=# INSERT INTO products (product_no, name, price) VALUES (5, 'Access', 5);
INSERT 0 1
postgres=#
postgres=#
postgres=# select * from products;
product_no | name | price
------------+------------+-------
1 | Java | 1234
2 | SQL Server | 3421
3 | Oracle | 7623
4 | DB2 | 9874
5 | Access | 5
(5 rows)
postgres=#
postgres=# -- Updates all products that have a price of 5 to have a price of 10:
postgres=# UPDATE products SET price = 10 WHERE price = 5;
UPDATE 1
postgres=#
postgres=# select * from products;
product_no | name | price
------------+------------+-------
1 | Java | 1234
2 | SQL Server | 3421
3 | Oracle | 7623
4 | DB2 | 9874
5 | Access | 10
(5 rows)
postgres=#
postgres=# drop table products;
DROP TABLE
postgres=#
postgres=#
|