-- Create the table CREATE TABLE users ( id SERIAL PRIMARY KEY, name VARCHAR(100) NOT NULL, age INTEGER, email VARCHAR(255) UNIQUE, registration_date DATE, last_login TIMESTAMP, is_active BOOLEAN DEFAULT true, score NUMERIC(5,2), preferences JSONB, description TEXT ); -- Insert sample data INSERT INTO users (name, age, email, registration_date, last_login, is_active, score, preferences, description) VALUES ('Alice Johnson', 28, '[email protected]', '2023-01-15', '2024-07-24 10:30:00', true, 85.50, '{"theme": "dark", "notifications": true}', 'Alice is a software engineer.'), ('Bob Smith', 35, '[email protected]', '2023-02-20', '2024-07-23 14:45:00', true, 92.75, '{"theme": "light", "notifications": false}', 'Bob works in marketing.'), ('Charlie Brown', 42, '[email protected]', '2023-03-10', '2024-07-22 09:15:00', false, 78.00, '{"theme": "auto", "notifications": true}', 'Charlie is a project manager.'), ('Diana Ross', 31, '[email protected]', '2023-04-05', '2024-07-24 11:00:00', true, 88.25, '{"theme": "dark", "notifications": true}', 'Diana is a data analyst.'), ('Edward Norton', 39, '[email protected]', '2023-05-12', '2024-07-21 16:30:00', true, 95.00, '{"theme": "light", "notifications": false}', 'Edward is a senior developer.');
SELECT * FROM users
Practice Postgres SQL commands using Postgres in WASM
Credit: @electric-sql/pglite