-- Database: Northwind DROP TABLE IF EXISTS Category; CREATE TABLE Category ( categoryid SERIAL PRIMARY KEY NOT NULL, categoryname VARCHAR (15) NOT NULL, description TEXT NULL, picture BYTEA NULL ); DROP TABLE IF EXISTS Region; CREATE TABLE Region ( regionid INT NOT NULL, regiondescription VARCHAR (50) NOT NULL, PRIMARY KEY ( regionid ) ); DROP TABLE IF EXISTS Territory; CREATE TABLE Territory ( territoryid VARCHAR (20) NOT NULL, territorydescription VARCHAR (50) NOT NULL, regionid INT NOT NULL, PRIMARY KEY ( territoryid ) ); DROP TABLE IF EXISTS CustomerCustomerDemographic; CREATE TABLE CustomerCustomerDemographic ( customerid VARCHAR (5) NOT NULL, customertypeid VARCHAR (10) NOT NULL, PRIMARY KEY ( customerid, customertypeid ) ); DROP TABLE IF EXISTS CustomerDemographic; CREATE TABLE CustomerDemographic ( customertypeid VARCHAR (10) NOT NULL, customerdesc TEXT NULL, PRIMARY KEY ( customertypeid ) ); DROP TABLE IF EXISTS Customer; CREATE TABLE Customer ( custid SERIAL PRIMARY KEY NOT NULL, companyname VARCHAR (40) NOT NULL, contactname VARCHAR (30) NULL, contacttitle VARCHAR (30) NULL, address VARCHAR (60) NULL, city VARCHAR (15) NULL, region VARCHAR (15) NULL, postalcode VARCHAR (10) NULL, country VARCHAR (15) NULL, phone VARCHAR (24) NULL, fax VARCHAR (24) NULL -- PRIMARY KEY ( custid ) ); DROP TABLE IF EXISTS Employee; CREATE TABLE Employee ( empid SERIAL PRIMARY KEY NOT NULL, lastname VARCHAR (20) NOT NULL, firstname VARCHAR (10) NOT NULL, title VARCHAR (30) NULL, titleofcourtesy VARCHAR (25) NULL, birthdate TIMESTAMP NULL, hiredate TIMESTAMP NULL, address VARCHAR (60) NULL, city VARCHAR (15) NULL, region VARCHAR (15) NULL, postalcode VARCHAR (10) NULL, country VARCHAR (15) NULL, phone VARCHAR (24) NULL, extension VARCHAR (4) NULL, photo BYTEA NULL, notes TEXT NULL, mgrid INT NULL, photopath VARCHAR (255) NULL -- PRIMARY KEY ( empid ) ); DROP TABLE IF EXISTS EmployeeTerritory; CREATE TABLE EmployeeTerritory ( employeeid INT NOT NULL, territoryid VARCHAR (20) NOT NULL, PRIMARY KEY ( employeeid, territoryid ) ); DROP TABLE IF EXISTS Product; CREATE TABLE Product ( productid SERIAL PRIMARY KEY NOT NULL, productname VARCHAR (40) NOT NULL, supplierid INT NULL, categoryid INT NULL, quantityperunit VARCHAR (20) NULL, unitprice DECIMAL(10, 2) NULL, unitsinstock SMALLINT NULL, unitsonorder SMALLINT NULL, reorderlevel SMALLINT NULL, discontinued CHAR(1) NOT NULL ); DROP TABLE IF EXISTS Shipper; CREATE TABLE Shipper ( shipperid SERIAL NOT NULL, companyname VARCHAR (40) NOT NULL, phone VARCHAR (44) NULL, PRIMARY KEY ( shipperid ) ); DROP TABLE IF EXISTS Supplier; CREATE TABLE Supplier ( supplierid SERIAL PRIMARY KEY NOT NULL, companyname VARCHAR (40) NOT NULL, contactname VARCHAR (30) NULL, contacttitle VARCHAR (30) NULL, address VARCHAR (60) NULL, city VARCHAR (15) NULL, region VARCHAR (15) NULL, postalcode VARCHAR (10) NULL, country VARCHAR (15) NULL, phone VARCHAR (24) NULL, fax VARCHAR (24) NULL, homepage TEXT NULL ); DROP TABLE IF EXISTS SalesOrder; CREATE TABLE SalesOrder ( orderid SERIAL NOT NULL, custid VARCHAR (15) NULL, empid INT NULL, orderdate TIMESTAMP NULL, requireddate TIMESTAMP NULL, shippeddate TIMESTAMP NULL, shipperid INT NULL, freight DECIMAL(10, 2) NULL, shipname VARCHAR (40) NULL, shipaddress VARCHAR (60) NULL, shipcity VARCHAR (15) NULL, shipregion VARCHAR (15) NULL, shippostalcode VARCHAR (10) NULL, shipcountry VARCHAR (15) NULL, chargeid VARCHAR (40) NULL, PRIMARY KEY ( orderid ) ); DROP TABLE IF EXISTS OrderDetail; INSERT INTO Shipper(shipperid, companyname, phone) VALUES(1, N'Shipper GVSUA', N'(503) 555-0137'); INSERT INTO Shipper(shipperid, companyname, phone) VALUES(2, N'Shipper ETYNR', N'(425) 555-0136'); INSERT INTO Shipper(shipperid, companyname, phone) VALUES(3, N'Shipper ZHISN', N'(415) 555-0138'); INSERT INTO SalesOrder(orderid, custid, empid, orderdate, requireddate, shippeddate, shipperid, freight, shipname, shipaddress, shipcity, shipregion, shippostalcode, shipcountry, chargeid) VALUES(10248, 85, 5, '20060704 00:00:00.000', '20060801 00:00:00.000', '20060716 00:00:00.000', 3, 32.38, N'Ship to 85-B', N'6789 rue de l''Abbaye', N'Reims', NULL, N'10345', N'France', 'ch_3LGOyYJTbVntZ3Uk0KuxDYcX'); INSERT INTO SalesOrder(orderid, custid, empid, orderdate, requireddate, shippeddate, shipperid, freight, shipname, shipaddress, shipcity, shipregion, shippostalcode, shipcountry, chargeid) VALUES(10249, 79, 6, '20060705 00:00:00.000', '20060816 00:00:00.000', '20060710 00:00:00.000', 1, 11.61, N'Ship to 79-C', N'Luisenstr. 9012', N'Münster', NULL, N'10328', N'Germany', 'ch_3LGOyYJTbVntZ3Uk0KuxDYcX'); INSERT INTO SalesOrder(orderid, custid, empid, orderdate, requireddate, shippeddate, shipperid, freight, shipname, shipaddress, shipcity, shipregion, shippostalcode, shipcountry, chargeid) VALUES(10250, 34, 4, '20060708 00:00:00.000', '20060805 00:00:00.000', '20060712 00:00:00.000', 2, 65.83, N'Destination SCQXA', N'Rua do Paço, 7890', N'Rio de Janeiro', N'RJ', N'10195', N'Brazil''ch_3LGOyYJTbVntZ3Uk0KuxDYcX'); INSERT INTO SalesOrder(orderid, custid, empid, orderdate, requireddate, shippeddate, shipperid, freight, shipname, shipaddress, shipcity, shipregion, shippostalcode, shipcountry, chargeid) VALUES(10251, 84, 3, '20060708 00:00:00.000', '20060805 00:00:00.000', '20060715 00:00:00.000', 1, 41.34, N'Ship to 84-A', N'3456, rue du Commerce', N'Lyon', NULL, N'10342', N'France''ch_3LGOyYJTbVntZ3Uk0KuxDYcX'); INSERT INTO SalesOrder(orderid, custid, empid, orderdate, requireddate, shippeddate, shipperid, freight, shipname, shipaddress, shipcity, shipregion, shippostalcode, shipcountry, chargeid) VALUES(10252, 76, 4, '20060709 00:00:00.000', '20060806 00:00:00.000', '20060711 00:00:00.000', 2, 51.30, N'Ship to 76-B', N'Boulevard Tirou, 9012', N'Charleroi', NULL, N'10318', N'Belgium''ch_3LGOyYJTbVntZ3Uk0KuxDYcX'); INSERT INTO SalesOrder(orderid, custid, empid, orderdate, requireddate, shippeddate, shipperid, freight, shipname, shipaddress, shipcity, shipregion, shippostalcode, shipcountry, chargeid) VALUES(10253, 34, 3, '20060710 00:00:00.000', '20060724 00:00:00.000', '20060716 00:00:00.000', 2, 58.17, N'Destination JPAIY', N'Rua do Paço, 8901', N'Rio de Janeiro', N'RJ', N'10196', N'Brazil''ch_3LGOyYJTbVntZ3Uk0KuxDYcX'); INSERT INTO SalesOrder(orderid, custid, empid, orderdate, requireddate, shippeddate, shipperid, freight, shipname, shipaddress, shipcity, shipregion, shippostalcode, shipcountry, chargeid) VALUES(10254, 14, 5, '20060711 00:00:00.000', '20060808 00:00:00.000', '20060723 00:00:00.000', 2, 22.98, N'Destination YUJRD', N'Hauptstr. 1234', N'Bern', NULL, N'10139', N'Switzerland''ch_3LGOyYJTbVntZ3Uk0KuxDYcX'); INSERT INTO SalesOrder(orderid, custid, empid, orderdate, requireddate, shippeddate, shipperid, freight, shipname, shipaddress, shipcity, shipregion, shippostalcode, shipcountry, chargeid) VALUES(10255, 68, 9, '20060712 00:00:00.000', '20060809 00:00:00.000', '20060715 00:00:00.000', 3, 148.33, N'Ship to 68-A', N'Starenweg 6789', N'Genève', NULL, N'10294', N'Switzerland''ch_3LGOyYJTbVntZ3Uk0KuxDYcX'); INSERT INTO SalesOrder(orderid, custid, empid, orderdate, requireddate, shippeddate, shipperid, freight, shipname, shipaddress, shipcity, shipregion, shippostalcode, shipcountry, chargeid) VALUES(10256, 88, 3, '20060715 00:00:00.000', '20060812 00:00:00.000', '20060717 00:00:00.000', 2, 13.97, N'Ship to 88-B', N'Rua do Mercado, 5678', N'Resende', N'SP', N'10354', N'Brazil''ch_3LGOyYJTbVntZ3Uk0KuxDYcX'); INSERT INTO SalesOrder(orderid, custid, empid, orderdate, requireddate, shippeddate, shipperid, freight, shipname, shipaddress, shipcity, shipregion, shippostalcode, shipcountry, chargeid) VALUES(10257, 35, 4, '20060716 00:00:00.000', '20060813 00:00:00.000', '20060722 00:00:00.000', 3, 81.91, N'Destination JYDLM', N'Carrera1234 con Ave. Carlos Soublette #8-35', N'San Cristóbal', N'Táchira', N'10199', N'Venezuela''ch_3LGOyYJTbVntZ3Uk0KuxDYcX'); INSERT INTO SalesOrder(orderid, custid, empid, orderdate, requireddate, shippeddate, shipperid, freight, shipname, shipaddress, shipcity, shipregion, shippostalcode, shipcountry, chargeid) VALUES(10258, 20, 1, '20060717 00:00:00.000', '20060814 00:00:00.000', '20060723 00:00:00.000', 1, 140.51, N'Destination RVDMF', N'Kirchgasse 9012', N'Graz', NULL, N'10157', N'Austria''ch_3LGOyYJTbVntZ3Uk0KuxDYcX'); INSERT INTO SalesOrder(orderid, custid, empid, orderdate, requireddate, shippeddate, shipperid, freight, shipname, shipaddress, shipcity, shipregion, shippostalcode, shipcountry, chargeid) VALUES(10259, 13, 4, '20060718 00:00:00.000', '20060815 00:00:00.000', '20060725 00:00:00.000', 3, 3.25, N'Destination LGGCH', N'Sierras de Granada 9012', N'México D.F.', NULL, N'10137', N'Mexico''ch_3LGOyYJTbVntZ3Uk0KuxDYcX'); INSERT INTO SalesOrder(orderid, custid, empid, orderdate, requireddate, shippeddate, shipperid, freight, shipname, shipaddress, shipcity, shipregion, shippostalcode, shipcountry, chargeid) VALUES(10260, 56, 4, '20060719 00:00:00.000', '20060816 00:00:00.000', '20060729 00:00:00.000', 1, 55.09, N'Ship to 56-A', N'Mehrheimerstr. 0123', N'Köln', NULL, N'10258', N'Germany''ch_3LGOyYJTbVntZ3Uk0KuxDYcX'); INSERT INTO SalesOrder(orderid, custid, empid, orderdate, requireddate, shippeddate, shipperid, freight, shipname, shipaddress, shipcity, shipregion, shippostalcode, shipcountry, chargeid) VALUES(10261, 61, 4, '20060719 00:00:00.000', '20060816 00:00:00.000', '20060730 00:00:00.000', 2, 3.05, N'Ship to 61-B', N'Rua da Panificadora, 6789', N'Rio de Janeiro', N'RJ', N'10274', N'Brazil''ch_3LGOyYJTbVntZ3Uk0KuxDYcX'); INSERT INTO SalesOrder(orderid, custid, empid, orderdate, requireddate, shippeddate, shipperid, freight, shipname, shipaddress, shipcity, shipregion, shippostalcode, shipcountry, chargeid) VALUES(10262, 65, 8, '20060722 00:00:00.000', '20060819 00:00:00.000', '20060725 00:00:00.000', 3, 48.29, N'Ship to 65-B', N'8901 Milton Dr.', N'Albuquerque', N'NM', N'10286', N'USA''ch_3LGOyYJTbVntZ3Uk0KuxDYcX'); INSERT INTO SalesOrder(orderid, custid, empid, orderdate, requireddate, shippeddate, shipperid, freight, shipname, shipaddress, shipcity, shipregion, shippostalcode, shipcountry, chargeid) VALUES(10263, 20, 9, '20060723 00:00:00.000', '20060820 00:00:00.000', '20060731 00:00:00.000', 3, 146.06, N'Destination FFXKT', N'Kirchgasse 0123', N'Graz', NULL, N'10158', N'Austria''ch_3LGOyYJTbVntZ3Uk0KuxDYcX'); INSERT INTO SalesOrder(orderid, custid, empid, orderdate, requireddate, shippeddate, shipperid, freight, shipname, shipaddress, shipcity, shipregion, shippostalcode, shipcountry, chargeid) VALUES(10264, 24, 6, '20060724 00:00:00.000', '20060821 00:00:00.000', '20060823 00:00:00.000', 3, 3.67, N'Destination KBSBN', N'Åkergatan 9012', N'Bräcke', NULL, N'10167', N'Sweden''ch_3LGOyYJTbVntZ3Uk0KuxDYcX'); INSERT INTO SalesOrder(orderid, custid, empid, orderdate, requireddate, shippeddate, shipperid, freight, shipname, shipaddress, shipcity, shipregion, shippostalcode, shipcountry, chargeid) VALUES(10265, 7, 2, '20060725 00:00:00.000', '20060822 00:00:00.000', '20060812 00:00:00.000', 1, 55.28, N'Ship to 7-A', N'0123, place Kléber', N'Strasbourg', NULL, N'10329', N'France''ch_3LGOyYJTbVntZ3Uk0KuxDYcX'); INSERT INTO SalesOrder(orderid, custid, empid, orderdate, requireddate, shippeddate, shipperid, freight, shipname, shipaddress, shipcity, shipregion, shippostalcode, shipcountry, chargeid) VALUES(10266, 87, 3, '20060726 00:00:00.000', '20060906 00:00:00.000', '20060731 00:00:00.000', 3, 25.73, N'Ship to 87-B', N'Torikatu 2345', N'Oulu', NULL, N'10351', N'Finland''ch_3LGOyYJTbVntZ3Uk0KuxDYcX'); INSERT INTO SalesOrder(orderid, custid, empid, orderdate, requireddate, shippeddate, shipperid, freight, shipname, shipaddress, shipcity, shipregion, shippostalcode, shipcountry, chargeid) VALUES(10267, 25, 4, '20060729 00:00:00.000', '20060826 00:00:00.000', '20060806 00:00:00.000', 1, 208.58, N'Destination VAPXU', N'Berliner Platz 0123', N'München', NULL, N'10168', N'Germany''ch_3LGOyYJTbVntZ3Uk0KuxDYcX'); INSERT INTO SalesOrder(orderid, custid, empid, orderdate, requireddate, shippeddate, shipperid, freight, shipname, shipaddress, shipcity, shipregion, shippostalcode, shipcountry, chargeid) VALUES(10268, 33, 8, '20060730 00:00:00.000', '20060827 00:00:00.000', '20060802 00:00:00.000', 3, 66.29, N'Destination QJVQH', N'5ª Ave. Los Palos Grandes 5678', N'Caracas', N'DF', N'10193', N'Venezuela''ch_3LGOyYJTbVntZ3Uk0KuxDYcX'); INSERT INTO SalesOrder(orderid, custid, empid, orderdate, requireddate, shippeddate, shipperid, freight, shipname, shipaddress, shipcity, shipregion, shippostalcode, shipcountry, chargeid) VALUES(10269, 89, 5, '20060731 00:00:00.000', '20060814 00:00:00.000', '20060809 00:00:00.000', 1, 4.56, N'Ship to 89-B', N'8901 - 12th Ave. S.', N'Seattle', N'WA', N'10357', N'USA''ch_3LGOyYJTbVntZ3Uk0KuxDYcX'); INSERT INTO SalesOrder(orderid, custid, empid, orderdate, requireddate, shippeddate, shipperid, freight, shipname, shipaddress, shipcity, shipregion, shippostalcode, shipcountry, chargeid) VALUES(10270, 87, 1, '20060801 00:00:00.000', '20060829 00:00:00.000', '20060802 00:00:00.000', 1, 136.54, N'Ship to 87-B', N'Torikatu 2345', N'Oulu', NULL, N'10351', N'Finland''ch_3LGOyYJTbVntZ3Uk0KuxDYcX'); INSERT INTO SalesOrder(orderid, custid, empid, orderdate, requireddate, shippeddate, shipperid, freight, shipname, shipaddress, shipcity, shipregion, shippostalcode, shipcountry, chargeid) VALUES(10271, 75, 6, '20060801 00:00:00.000', '20060829 00:00:00.000', '20060830 00:00:00.000', 2, 4.54, N'Ship to 75-C', N'P.O. Box 7890', N'Lander', N'WY', N'10316', N'USA''ch_3LGOyYJTbVntZ3Uk0KuxDYcX'); INSERT INTO SalesOrder(orderid, custid, empid, orderdate, requireddate, shippeddate, shipperid, freight, shipname, shipaddress, shipcity, shipregion, shippostalcode, shipcountry, chargeid) VALUES(10272, 65, 6, '20060802 00:00:00.000', '20060830 00:00:00.000', '20060806 00:00:00.000', 2, 98.03, N'Ship to 65-A', N'7890 Milton Dr.', N'Albuquerque', N'NM', N'10285', N'USA''ch_3LGOyYJTbVntZ3Uk0KuxDYcX'); INSERT INTO SalesOrder(orderid, custid, empid, orderdate, requireddate, shippeddate, shipperid, freight, shipname, shipaddress, shipcity, shipregion, shippostalcode, shipcountry, chargeid) VALUES(10273, 63, 3, '20060805 00:00:00.000', '20060902 00:00:00.000', '20060812 00:00:00.000', 3, 76.07, N'Ship to 63-A', N'Taucherstraße 1234', N'Cunewalde', NULL, N'10279', N'Germany''ch_3LGOyYJTbVntZ3Uk0KuxDYcX'); INSERT INTO SalesOrder(orderid, custid, empid, orderdate, requireddate, shippeddate, shipperid, freight, shipname, shipaddress, shipcity, shipregion, shippostalcode, shipcountry, chargeid) VALUES(10274, 85, 6, '20060806 00:00:00.000', '20060903 00:00:00.000', '20060816 00:00:00.000', 1, 6.01, N'Ship to 85-B', N'6789 rue de l''Abbaye', N'Reims', NULL, N'10345', N'France''ch_3LGOyYJTbVntZ3Uk0KuxDYcX'); INSERT INTO SalesOrder(orderid, custid, empid, orderdate, requireddate, shippeddate, shipperid, freight, shipname, shipaddress, shipcity, shipregion, shippostalcode, shipcountry, chargeid) VALUES(10275, 49, 1, '20060807 00:00:00.000', '20060904 00:00:00.000', '20060809 00:00:00.000', 1, 26.93, N'Ship to 49-A', N'Via Ludovico il Moro 8901', N'Bergamo', NULL, N'10235', N'Italy''ch_3LGOyYJTbVntZ3Uk0KuxDYcX'); INSERT INTO SalesOrder(orderid, custid, empid, orderdate, requireddate, shippeddate, shipperid, freight, shipname, shipaddress, shipcity, shipregion, shippostalcode, shipcountry, chargeid) VALUES(10276, 80, 8, '20060808 00:00:00.000', '20060822 00:00:00.000', '20060814 00:00:00.000', 3, 13.84, N'Ship to 80-C', N'Avda. Azteca 5678', N'México D.F.', NULL, N'10334', N'Mexico''ch_3LGOyYJTbVntZ3Uk0KuxDYcX'); INSERT INTO SalesOrder(orderid, custid, empid, orderdate, requireddate, shippeddate, shipperid, freight, shipname, shipaddress, shipcity, shipregion, shippostalcode, shipcountry, chargeid) VALUES(10277, 52, 2, '20060809 00:00:00.000', '20060906 00:00:00.000', '20060813 00:00:00.000', 3, 125.77, N'Ship to 52-A', N'Heerstr. 9012', N'Leipzig', NULL, N'10247', N'Germany''ch_3LGOyYJTbVntZ3Uk0KuxDYcX'); INSERT INTO SalesOrder(orderid, custid, empid, orderdate, requireddate, shippeddate, shipperid, freight, shipname, shipaddress, shipcity, shipregion, shippostalcode, shipcountry, chargeid) VALUES(10278, 5, 8, '20060812 00:00:00.000', '20060909 00:00:00.000', '20060816 00:00:00.000', 2, 92.69, N'Ship to 5-C', N'Berguvsvägen 1234', N'Luleå', NULL, N'10269', N'Sweden''ch_3LGOyYJTbVntZ3Uk0KuxDYcX'); INSERT INTO SalesOrder(orderid, custid, empid, orderdate, requireddate, shippeddate, shipperid, freight, shipname, shipaddress, shipcity, shipregion, shippostalcode, shipcountry, chargeid) VALUES(10279, 44, 8, '20060813 00:00:00.000', '20060910 00:00:00.000', '20060816 00:00:00.000', 2, 25.83, N'Ship to 44-A', N'Magazinweg 4567', N'Frankfurt a.M.', NULL, N'10222', N'Germany''ch_3LGOyYJTbVntZ3Uk0KuxDYcX'); INSERT INTO SalesOrder(orderid, custid, empid, orderdate, requireddate, shippeddate, shipperid, freight, shipname, shipaddress, shipcity, shipregion, shippostalcode, shipcountry, chargeid) VALUES(10280, 5, 2, '20060814 00:00:00.000', '20060911 00:00:00.000', '20060912 00:00:00.000', 1, 8.98, N'Ship to 5-B', N'Berguvsvägen 0123', N'Luleå', NULL, N'10268', N'Sweden''ch_3LGOyYJTbVntZ3Uk0KuxDYcX'); INSERT INTO SalesOrder(orderid, custid, empid, orderdate, requireddate, shippeddate, shipperid, freight, shipname, shipaddress, shipcity, shipregion, shippostalcode, shipcountry, chargeid) VALUES(10281, 69, 4, '20060814 00:00:00.000', '20060828 00:00:00.000', '20060821 00:00:00.000', 1, 2.94, N'Ship to 69-A', N'Gran Vía, 9012', N'Madrid', NULL, N'10297', N'Spain''ch_3LGOyYJTbVntZ3Uk0KuxDYcX'); INSERT INTO SalesOrder(orderid, custid, empid, orderdate, requireddate, shippeddate, shipperid, freight, shipname, shipaddress, shipcity, shipregion, shippostalcode, shipcountry, chargeid) VALUES(10282, 69, 4, '20060815 00:00:00.000', '20060912 00:00:00.000', '20060821 00:00:00.000', 1, 12.69, N'Ship to 69-B', N'Gran Vía, 0123', N'Madrid', NULL, N'10298', N'Spain''ch_3LGOyYJTbVntZ3Uk0KuxDYcX'); INSERT INTO SalesOrder(orderid, custid, empid, orderdate, requireddate, shippeddate, shipperid, freight, shipname, shipaddress, shipcity, shipregion, shippostalcode, shipcountry, chargeid) VALUES(10283, 46, 3, '20060816 00:00:00.000', '20060913 00:00:00.000', '20060823 00:00:00.000', 3, 84.81, N'Ship to 46-A', N'Carrera 0123 con Ave. Bolívar #65-98 Llano Largo', N'Barquisimeto', N'Lara', N'10227', N'Venezuela''ch_3LGOyYJTbVntZ3Uk0KuxDYcX'); INSERT INTO SalesOrder(orderid, custid, empid, orderdate, requireddate, shippeddate, shipperid, freight, shipname, shipaddress, shipcity, shipregion, shippostalcode, shipcountry, chargeid) VALUES(10284, 44, 4, '20060819 00:00:00.000', '20060916 00:00:00.000', '20060827 00:00:00.000', 1, 76.56, N'Ship to 44-A', N'Magazinweg 4567', N'Frankfurt a.M.', NULL, N'10222', N'Germany''ch_3LGOyYJTbVntZ3Uk0KuxDYcX'); INSERT INTO SalesOrder(orderid, custid, empid, orderdate, requireddate, shippeddate, shipperid, freight, shipname, shipaddress, shipcity, shipregion, shippostalcode, shipcountry, chargeid) VALUES(10285, 63, 1, '20060820 00:00:00.000', '20060917 00:00:00.000', '20060826 00:00:00.000', 2, 76.83, N'Ship to 63-B', N'Taucherstraße 2345', N'Cunewalde', NULL, N'10280', N'Germany''ch_3LGOyYJTbVntZ3Uk0KuxDYcX'); INSERT INTO SalesOrder(orderid, custid, empid, orderdate, requireddate, shippeddate, shipperid, freight, shipname, shipaddress, shipcity, shipregion, shippostalcode, shipcountry, chargeid) VALUES(10286, 63, 8, '20060821 00:00:00.000', '20060918 00:00:00.000', '20060830 00:00:00.000', 3, 229.24, N'Ship to 63-B', N'Taucherstraße 2345', N'Cunewalde', NULL, N'10280', N'Germany''ch_3LGOyYJTbVntZ3Uk0KuxDYcX'); INSERT INTO SalesOrder(orderid, custid, empid, orderdate, requireddate, shippeddate, shipperid, freight, shipname, shipaddress, shipcity, shipregion, shippostalcode, shipcountry, chargeid) VALUES(10287, 67, 8, '20060822 00:00:00.000', '20060919 00:00:00.000', '20060828 00:00:00.000', 3, 12.76, N'Ship to 67-A', N'Av. Copacabana, 3456', N'Rio de Janeiro', N'RJ', N'10291', N'Brazil''ch_3LGOyYJTbVntZ3Uk0KuxDYcX'); INSERT INTO SalesOrder(orderid, custid, empid, orderdate, requireddate, shippeddate, shipperid, freight, shipname, shipaddress, shipcity, shipregion, shippostalcode, shipcountry, chargeid) VALUES(10288, 66, 4, '20060823 00:00:00.000', '20060920 00:00:00.000', '20060903 00:00:00.000', 1, 7.45, N'Ship to 66-C', N'Strada Provinciale 2345', N'Reggio Emilia', NULL, N'10290', N'Italy''ch_3LGOyYJTbVntZ3Uk0KuxDYcX'); INSERT INTO SalesOrder(orderid, custid, empid, orderdate, requireddate, shippeddate, shipperid, freight, shipname, shipaddress, shipcity, shipregion, shippostalcode, shipcountry, chargeid) VALUES(10289, 11, 7, '20060826 00:00:00.000', '20060923 00:00:00.000', '20060828 00:00:00.000', 3, 22.77, N'Destination DLEUN', N'Fauntleroy Circus 4567', N'London', NULL, N'10132', N'UK''ch_3LGOyYJTbVntZ3Uk0KuxDYcX'); INSERT INTO SalesOrder(orderid, custid, empid, orderdate, requireddate, shippeddate, shipperid, freight, shipname, shipaddress, shipcity, shipregion, shippostalcode, shipcountry, chargeid) VALUES(10290, 15, 8, '20060827 00:00:00.000', '20060924 00:00:00.000', '20060903 00:00:00.000', 1, 79.70, N'Destination HQZHO', N'Av. dos Lusíadas, 4567', N'Sao Paulo', N'SP', N'10142', N'Brazil''ch_3LGOyYJTbVntZ3Uk0KuxDYcX'); INSERT INTO SalesOrder(orderid, custid, empid, orderdate, requireddate, shippeddate, shipperid, freight, shipname, shipaddress, shipcity, shipregion, shippostalcode, shipcountry, chargeid) VALUES(10291, 61, 6, '20060827 00:00:00.000', '20060924 00:00:00.000', '20060904 00:00:00.000', 2, 6.40, N'Ship to 61-A', N'Rua da Panificadora, 5678', N'Rio de Janeiro', N'RJ', N'10273', N'Brazil''ch_3LGOyYJTbVntZ3Uk0KuxDYcX'); INSERT INTO SalesOrder(orderid, custid, empid, orderdate, requireddate, shippeddate, shipperid, freight, shipname, shipaddress, shipcity, shipregion, shippostalcode, shipcountry, chargeid) VALUES(10292, 81, 1, '20060828 00:00:00.000', '20060925 00:00:00.000', '20060902 00:00:00.000', 2, 1.35, N'Ship to 81-A', N'Av. Inês de Castro, 6789', N'Sao Paulo', N'SP', N'10335', N'Brazil''ch_3LGOyYJTbVntZ3Uk0KuxDYcX'); INSERT INTO SalesOrder(orderid, custid, empid, orderdate, requireddate, shippeddate, shipperid, freight, shipname, shipaddress, shipcity, shipregion, shippostalcode, shipcountry, chargeid) VALUES(10293, 80, 1, '20060829 00:00:00.000', '20060926 00:00:00.000', '20060911 00:00:00.000', 3, 21.18, N'Ship to 80-B', N'Avda. Azteca 4567', N'México D.F.', NULL, N'10333', N'Mexico''ch_3LGOyYJTbVntZ3Uk0KuxDYcX'); INSERT INTO SalesOrder(orderid, custid, empid, orderdate, requireddate, shippeddate, shipperid, freight, shipname, shipaddress, shipcity, shipregion, shippostalcode, shipcountry, chargeid) VALUES(10294, 65, 4, '20060830 00:00:00.000', '20060927 00:00:00.000', '20060905 00:00:00.000', 2, 147.26, N'Ship to 65-A', N'7890 Milton Dr.', N'Albuquerque', N'NM', N'10285', N'USA''ch_3LGOyYJTbVntZ3Uk0KuxDYcX'); INSERT INTO SalesOrder(orderid, custid, empid, orderdate, requireddate, shippeddate, shipperid, freight, shipname, shipaddress, shipcity, shipregion, shippostalcode, shipcountry, chargeid) VALUES(10295, 85, 2, '20060902 00:00:00.000', '20060930 00:00:00.000', '20060910 00:00:00.000', 2, 1.15, N'Ship to 85-C', N'7890 rue de l''Abbaye', N'Reims', NULL, N'10346', N'France''ch_3LGOyYJTbVntZ3Uk0KuxDYcX'); INSERT INTO SalesOrder(orderid, custid, empid, orderdate, requireddate, shippeddate, shipperid, freight, shipname, shipaddress, shipcity, shipregion, shippostalcode, shipcountry, chargeid) VALUES(10296, 46, 6, '20060903 00:00:00.000', '20061001 00:00:00.000', '20060911 00:00:00.000', 1, 0.12, N'Ship to 46-C', N'Carrera 2345 con Ave. Bolívar #65-98 Llano Largo', N'Barquisimeto', N'Lara', N'10229', N'Venezuela''ch_3LGOyYJTbVntZ3Uk0KuxDYcX'); INSERT INTO SalesOrder(orderid, custid, empid, orderdate, requireddate, shippeddate, shipperid, freight, shipname, shipaddress, shipcity, shipregion, shippostalcode, shipcountry, chargeid) VALUES(10297, 7, 5, '20060904 00:00:00.000', '20061016 00:00:00.000', '20060910 00:00:00.000', 2, 5.74, N'Ship to 7-C', N'2345, place Kléber', N'Strasbourg', NULL, N'10331', N'France''ch_3LGOyYJTbVntZ3Uk0KuxDYcX'); INSERT INTO SalesOrder(orderid, custid, empid, orderdate, requireddate, shippeddate, shipperid, freight, shipname, shipaddress, shipcity, shipregion, shippostalcode, shipcountry, chargeid) VALUES(10298, 37, 6, '20060905 00:00:00.000', '20061003 00:00:00.000', '20060911 00:00:00.000', 2, 168.22, N'Destination ATSOA', N'4567 Johnstown Road', N'Cork', N'Co. Cork', N'10202', N'Ireland''ch_3LGOyYJTbVntZ3Uk0KuxDYcX'); INSERT INTO SalesOrder(orderid, custid, empid, orderdate, requireddate, shippeddate, shipperid, freight, shipname, shipaddress, shipcity, shipregion, shippostalcode, shipcountry, chargeid) VALUES(10299, 67, 4, '20060906 00:00:00.000', '20061004 00:00:00.000', '20060913 00:00:00.000', 2, 29.76, N'Ship to 67-A', N'Av. Copacabana, 3456', N'Rio de Janeiro', N'RJ', N'10291', N'Brazil''ch_3LGOyYJTbVntZ3Uk0KuxDYcX'); INSERT INTO SalesOrder(orderid, custid, empid, orderdate, requireddate, shippeddate, shipperid, freight, shipname, shipaddress, shipcity, shipregion, shippostalcode, shipcountry, chargeid) VALUES(10300, 49, 2, '20060909 00:00:00.000', '20061007 00:00:00.000', '20060918 00:00:00.000', 2, 17.68, N'Ship to 49-A', N'Via Ludovico il Moro 8901', N'Bergamo', NULL, N'10235', N'Italy''ch_3LGOyYJTbVntZ3Uk0KuxDYcX'); INSERT INTO SalesOrder(orderid, custid, empid, orderdate, requireddate, shippeddate, shipperid, freight, shipname, shipaddress, shipcity, shipregion, shippostalcode, shipcountry, chargeid) VALUES(10301, 86, 8, '20060909 00:00:00.000', '20061007 00:00:00.000', '20060917 00:00:00.000', 2, 45.08, N'Ship to 86-A', N'Adenauerallee 8901', N'Stuttgart', NULL, N'10347', N'Germany''ch_3LGOyYJTbVntZ3Uk0KuxDYcX'); INSERT INTO SalesOrder(orderid, custid, empid, orderdate, requireddate, shippeddate, shipperid, freight, shipname, shipaddress, shipcity, shipregion, shippostalcode, shipcountry, chargeid) VALUES(10302, 76, 4, '20060910 00:00:00.000', '20061008 00:00:00.000', '20061009 00:00:00.000', 2, 6.27, N'Ship to 76-B', N'Boulevard Tirou, 9012', N'Charleroi', NULL, N'10318', N'Belgium''ch_3LGOyYJTbVntZ3Uk0KuxDYcX'); INSERT INTO SalesOrder(orderid, custid, empid, orderdate, requireddate, shippeddate, shipperid, freight, shipname, shipaddress, shipcity, shipregion, shippostalcode, shipcountry, chargeid) VALUES(10303, 30, 7, '20060911 00:00:00.000', '20061009 00:00:00.000', '20060918 00:00:00.000', 2, 107.83, N'Destination IIYDD', N'C/ Romero, 5678', N'Sevilla', NULL, N'10183', N'Spain''ch_3LGOyYJTbVntZ3Uk0KuxDYcX'); INSERT INTO SalesOrder(orderid, custid, empid, orderdate, requireddate, shippeddate, shipperid, freight, shipname, shipaddress, shipcity, shipregion, shippostalcode, shipcountry, chargeid) VALUES(10304, 80, 1, '20060912 00:00:00.000', '20061010 00:00:00.000', '20060917 00:00:00.000', 2, 63.79, N'Ship to 80-C', N'Avda. Azteca 5678', N'México D.F.', NULL, N'10334', N'Mexico''ch_3LGOyYJTbVntZ3Uk0KuxDYcX'); INSERT INTO SalesOrder(orderid, custid, empid, orderdate, requireddate, shippeddate, shipperid, freight, shipname, shipaddress, shipcity, shipregion, shippostalcode, shipcountry, chargeid) VALUES(10305, 55, 8, '20060913 00:00:00.000', '20061011 00:00:00.000', '20061009 00:00:00.000', 3, 257.62, N'Ship to 55-B', N'8901 Bering St.', N'Anchorage', N'AK', N'10256', N'USA''ch_3LGOyYJTbVntZ3Uk0KuxDYcX'); INSERT INTO SalesOrder(orderid, custid, empid, orderdate, requireddate, shippeddate, shipperid, freight, shipname, shipaddress, shipcity, shipregion, shippostalcode, shipcountry, chargeid) VALUES(10306, 69, 1, '20060916 00:00:00.000', '20061014 00:00:00.000', '20060923 00:00:00.000', 3, 7.56, N'Ship to 69-B', N'Gran Vía, 0123', N'Madrid', NULL, N'10298', N'Spain''ch_3LGOyYJTbVntZ3Uk0KuxDYcX'); INSERT INTO SalesOrder(orderid, custid, empid, orderdate, requireddate, shippeddate, shipperid, freight, shipname, shipaddress, shipcity, shipregion, shippostalcode, shipcountry, chargeid) VALUES(10307, 48, 2, '20060917 00:00:00.000', '20061015 00:00:00.000', '20060925 00:00:00.000', 2, 0.56, N'Ship to 48-B', N'6789 Chiaroscuro Rd.', N'Portland', N'OR', N'10233', N'USA''ch_3LGOyYJTbVntZ3Uk0KuxDYcX'); INSERT INTO SalesOrder(orderid, custid, empid, orderdate, requireddate, shippeddate, shipperid, freight, shipname, shipaddress, shipcity, shipregion, shippostalcode, shipcountry, chargeid) VALUES(10308, 2, 7, '20060918 00:00:00.000', '20061016 00:00:00.000', '20060924 00:00:00.000', 3, 1.61, N'Destination QMVCI', N'Avda. de la Constitución 2345', N'México D.F.', NULL, N'10180', N'Mexico''ch_3LGOyYJTbVntZ3Uk0KuxDYcX'); INSERT INTO SalesOrder(orderid, custid, empid, orderdate, requireddate, shippeddate, shipperid, freight, shipname, shipaddress, shipcity, shipregion, shippostalcode, shipcountry, chargeid) VALUES(10309, 37, 3, '20060919 00:00:00.000', '20061017 00:00:00.000', '20061023 00:00:00.000', 1, 47.30, N'Destination ATSOA', N'4567 Johnstown Road', N'Cork', N'Co. Cork', N'10202', N'Ireland''ch_3LGOyYJTbVntZ3Uk0KuxDYcX'); INSERT INTO SalesOrder(orderid, custid, empid, orderdate, requireddate, shippeddate, shipperid, freight, shipname, shipaddress, shipcity, shipregion, shippostalcode, shipcountry, chargeid) VALUES(10310, 77, 8, '20060920 00:00:00.000', '20061018 00:00:00.000', '20060927 00:00:00.000', 2, 17.52, N'Ship to 77-B', N'2345 Jefferson Way Suite 2', N'Portland', N'OR', N'10321', N'USA''ch_3LGOyYJTbVntZ3Uk0KuxDYcX');
Write, Run & Share PostgreSQL queries online using OneCompiler's PostgreSQL online editor and compiler for free. It's one of the robust, feature-rich online editor and compiler for PostgreSQL. Getting started with the OneCompiler's PostgreSQL editor is really simple and pretty fast. The editor shows sample boilerplate code when you choose database as 'PostgreSQL' and start writing queries to learn and test online without worrying about tedious process of installation.
PostgreSQL is a open source relational database system and is also knows as Postgres.
CREATE command is used to create a table, schema or an index.
CREATE TABLE table_name (
column1 datatype,
column2 datatype,
....);
ALTER command is used to add, modify or delete columns or constraints from the database table.
ALTER TABLE Table_name ADD column_name datatype;
TRUNCATE command is used to delete the data present in the table but this will not delete the table.
TRUNCATE table table_name;
DROP command is used to delete the table along with its data.
DROP TABLE table_name;
RENAME command is used to rename the table name.
ALTER TABLE table_name1 RENAME to new_table_name1;
INSERT Statement is used to insert new records into the database table.
INSERT INTO table_name (column1, column2, column3, ...) VALUES (value1, value2, value3, ...);
Select statement is used to select data from database tables.
SELECT column1, column2, ...
FROM table_name;
UPDATE statement is used to modify the existing values of records present in the database table.
UPDATE table_name
SET column1 = value1, column2 = value2, ...
WHERE condition;
DELETE statement is used to delete the existing records present in the database table.
DELETE FROM table_name where condition;