Login   Register  
PHP Classes
elePHPant
Icontem

File: data/databases_pgsql.sql

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Giovanni Ramos  >  PDO4You  >  data/databases_pgsql.sql  >  Download  
File: data/databases_pgsql.sql
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: PDO4You
Access SQL databases using the PDO extension
Author: By
Last change: Update
Date: 1 year ago
Size: 1,333 bytes
 

Contents

Class file image Download
---------------------------------
--CREATE DATABASE pdo4you;
---------------------------------
DROP SCHEMA IF EXISTS public CASCADE; CREATE SCHEMA public;
CREATE TABLE public.users (
	id SERIAL NOT NULL,
	firstname VARCHAR(20) NOT NULL,
	lastname VARCHAR(20) NOT NULL,
	mail VARCHAR(30) NULL,
	PRIMARY KEY (id)
);

INSERT INTO public.users (firstname, lastname, mail) VALUES 
('Giovanni', 'Ramos', 'pdo4you@gmail.com');

SELECT setval('public.users_id_seq', max("id") ) FROM public.users;

CREATE TABLE public.books (
	id SERIAL NOT NULL,
	title VARCHAR(100) NOT NULL,
	author VARCHAR(50) NOT NULL,
	description TEXT NULL,
	PRIMARY KEY (id)
);

INSERT INTO public.books VALUES 
(1, 'Etiam tristique justo sit amet neque suscipit eget pretium lectus tempor.', 'Giovanni Ramos', NULL);

SELECT setval('public.books_id_seq', max("id") ) FROM public.books;


---------------------------------
--CREATE DATABASE bookstore;
---------------------------------
DROP SCHEMA IF EXISTS public CASCADE; CREATE SCHEMA public;
CREATE TABLE public.books (
	id SERIAL NOT NULL,
	title VARCHAR(100) NOT NULL,
	author VARCHAR(50) NOT NULL,
	description TEXT NULL,
	PRIMARY KEY (id)
);

INSERT INTO public.books VALUES 
(1, 'PostgreSQL: Up and Running', 'Regina Obe, Leo Hsu', NULL);

SELECT setval('public.books_id_seq', max("id") ) FROM public.books;