Oz Web Services
  • Home
  • WP
  • PHP
  • JS
  • CSS
  • SCSS
  • HTML
  • XML
  • JSON
  • SQL
  • .htaccess
  • Apache
  • Nginx
  • INI
  • HTTP
  • Diff
Search shortcode

Example: SQL

May 13, 2014
BEGIN;
CREATE TABLE "topic" (
	"id" serial NOT NULL PRIMARY KEY,
	"forum_id" integer NOT NULL,
	"subject" varchar(255) NOT NULL
);
ALTER TABLE "topic" ADD CONSTRAINT forum_id FOREIGN KEY ("forum_id") REFERENCES "forum" ("id");

-- Initials
insert into "topic" ("forum_id", "subject") values (2, 'D''artagnian');

select count(*) from cicero_forum;

-- this line lacks ; at the end to allow people to be sloppy and omit it in one-liners
COMMIT
Oz Web Services
Copyright © 2015-2023 All Rights Reserved