-- Create a new database | |
CREATE DATABASE mydb; | |
-- Connect to the new database | |
\c mydb; | |
-- Create a new table | |
CREATE TABLE users ( | |
id SERIAL PRIMARY KEY, | |
name VARCHAR(50) NOT NULL, | |
email VARCHAR(50) UNIQUE NOT NULL | |
); | |
-- Insert some sample data | |
INSERT INTO users (name, email) VALUES | |
('John Doe', '[email protected]'), | |
('Jane Smith', '[email protected]'), | |
('Bob Johnson', '[email protected]'); | |