repositories / dotfiles
dotfiles
bugabingas dorkfiles
owned by admin
neovim/sample_files/test.sql
Raw-- Test SQL file for sqls LSP
CREATE TABLE IF NOT EXISTS users (
id SERIAL PRIMARY KEY,
username VARCHAR(255) NOT NULL UNIQUE,
email VARCHAR(255) NOT NULL,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
CREATE TABLE IF NOT EXISTS posts (
id SERIAL PRIMARY KEY,
user_id INTEGER REFERENCES users(id),
title VARCHAR(500) NOT NULL,
body TEXT,
published BOOLEAN DEFAULT FALSE
);
SELECT u.username, p.title, p.body
FROM users u
JOIN posts p ON u.id = p.user_id
WHERE p.published = TRUE
ORDER BY p.created_at DESC;
INSERT INTO users (username, email)
VALUES ('alice', 'alice@example.com');