Login   Register  
PHP Classes
elePHPant
Icontem

File: data/databases_sqlsrv.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_sqlsrv.sql  >  Download  
File: data/databases_sqlsrv.sql
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: PDO4You
Access SQL databases using the PDO extension
Author: By
Last change: Add SQLite databases
Date: 1 year ago
Size: 1,239 bytes
 

Contents

Class file image Download
---------------------------------
--CREATE DATABASE pdo4you;
---------------------------------
IF OBJECT_ID('users') IS NOT NULL DROP TABLE users;
CREATE TABLE users (
	id INT NOT NULL IDENTITY,
	firstname VARCHAR(20) NOT NULL,
	lastname VARCHAR(20) NOT NULL,
	mail VARCHAR(30) NULL,
	PRIMARY KEY (id)
);

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

CREATE SEQUENCE users_id_seq START WITH 1 INCREMENT BY 1;


IF OBJECT_ID('books') IS NOT NULL DROP TABLE books;
CREATE TABLE books (
	id INT NOT NULL,
	title VARCHAR(50) NOT NULL,
	author VARCHAR(50) NOT NULL,
	description TEXT NULL,
	PRIMARY KEY (id)
);

INSERT INTO books VALUES 
(1, 'Nam pharetra nisi eu leo consectetur semper.', 'Giovanni Ramos', NULL);

CREATE SEQUENCE books_id_seq START WITH 1 INCREMENT BY 1;


---------------------------------
--CREATE DATABASE bookstore;
---------------------------------
DROP TABLE IF EXISTS books;
CREATE TABLE books (
	id INT NOT NULL,
	title VARCHAR(50) NOT NULL,
	author VARCHAR(50) NOT NULL,
	description TEXT NULL,
	PRIMARY KEY (id)
);

INSERT INTO books VALUES 
(1, 'SQL Server Developer Edition 2012', 'Microsoft', NULL);

CREATE SEQUENCE books_id_seq START WITH 1 INCREMENT BY 1;