First some useful commands:
list if databases:
\l
switch to a database:
\c exampledatabase
now it is time to create a table:
CREATE TABLE products (id serial primary key, name varchar (50) not null, price varchar (50) not null);
we have a table but no entries, so:
INSERT INTO products (name, price) VALUES ('hamburger','10');
to check the tables:
\dt
and to see entries on our table:
SELECT * FROM products
wish you an easy coding!
Top comments (0)