EN
PostgreSQL example tables
0
points
TABLE 1
DROP TABLE IF EXISTS "users";
CREATE TABLE "users" (
"id" SERIAL,
"name" VARCHAR(100) NOT NULL,
"country" VARCHAR(15) NOT NULL,
PRIMARY KEY ("id")
);
INSERT INTO "users"
("name", "country")
VALUES
('Tom', 'Poland'),
('Chris', 'Spain'),
('Jack', 'Spain'),
('Kim', 'Vietnam'),
('Marco', 'Italy'),
('Kate', 'Spain'),
('Nam', 'Vietnam');
TABLE 2
DROP TABLE IF EXISTS "users";
CREATE TABLE "users" (
"id" SERIAL,
"name" VARCHAR(50) NOT NULL,
"surname" VARCHAR(50) NOT NULL,
"email" VARCHAR(50),
PRIMARY KEY ("id")
);
INSERT INTO "users"
( "name", "surname", "email")
VALUES
('John', 'Stewart', 'john@email.com'),
('Chris', 'Brown', ''),
('Kate', 'Lewis',''),
('Ailisa', 'Gomez', 'ailisa@email.com'),
('Gwendolyn', 'James', NULL),
('Simon', 'Collins', NULL),
('Taylor', 'Martin',NULL),
('Andrew', 'Thompson', 'andrew123@email.com');
TABLE 3
DROP TABLE IF EXISTS "users";
CREATE TABLE "users" (
"id" SERIAL,
"name" VARCHAR(100) NOT NULL,
"email" VARCHAR(100) NOT NULL,
"country" VARCHAR(15) NOT NULL,
PRIMARY KEY ("id")
);
INSERT INTO "users"
("name", "email", "country")
VALUES
('Tom', 'tom@email.com', 'Poland'),
('Chris', 'chris@email.com', 'Spain'),
('Jack', 'jack@email.com', 'Spain'),
('Kim', 'kim@email.com', 'Vietnam'),
('Marco', 'marco@email.com', 'Italy'),
('Kate', 'kate@email.com', 'Spain'),
('Nam', 'nam@email.com', 'Vietnam');
TABLE 4
DROP TABLE IF EXISTS "users";
CREATE TABLE "users" (
"id" SERIAL,
"name" VARCHAR(50) NOT NULL,
"surname" VARCHAR(50) NOT NULL,
"email" VARCHAR(50),
PRIMARY KEY ("id")
);
INSERT INTO "users"
( "name", "surname", "email")
VALUES
('John', 'Stewart', 'john@email.com'),
('Chris', 'Brown', NULL),
('Kate', 'Lewis', NULL),
('Ailisa', 'Gomez', 'ailisa@email.com'),
('Gwendolyn', 'James', NULL),
('Simon', 'Collins', NULL),
('Taylor', 'Martin', NULL),
('Andrew', 'Thompson', 'andrew@email.com');
TABLE 5
DROP TABLE IF EXISTS "users";
CREATE TABLE "users" (
"id" SERIAL,
"name" VARCHAR(100) NOT NULL,
"email" VARCHAR(100) NOT NULL,
"country" VARCHAR(15) NOT NULL,
PRIMARY KEY ("id")
);
INSERT INTO "users"
( "name", "surname", "email")
VALUES
('John', 'Stewart', 'john@email.com'),
('Chris', 'Brown', NULL),
('Kate', 'Lewis', NULL),
('Ailisa', 'Gomez', 'ailisa@email.com'),
('Gwendolyn', 'James', NULL),
('Simon', 'Collins', NULL),
('Taylor', 'Martin', NULL),
('Andrew', 'Thompson', 'andrew@email.com');
TABLE 6
DROP TABLE IF EXISTS "users";
CREATE TABLE "users" (
"id" SERIAL,
"name" VARCHAR(50) NOT NULL,
"surname" VARCHAR(50) NOT NULL,
"department_id" INTEGER,
"salary" DECIMAL(15,2) NOT NULL,
PRIMARY KEY ("id")
);
INSERT INTO "users"
( "name", "surname", "department_id", "salary")
VALUES
('John', 'Stewart', 1, '2000.00'),
('Chris', 'Brown', 3, '2000.00'),
('Chris', 'Lewis', 3, '2000.00'),
('Kate', 'Lewis', 3, '2000.00'),
('Kate', 'Stewart', 3, '2000.00'),
('Ailisa', 'Lewis', 3, '2000.00'),
('Ailisa', 'Gomez', 3, '3000.00'),
('Gwendolyn', 'James', 2, '3000.00'),
('Simon', 'James', 2, '2000.00'),
('Simon', 'Brown', 3, '2000.00'),
('Simon', 'Collins', 3, '3000.00');
TABLE 7
DROP TABLE IF EXISTS "users";
CREATE TABLE "users" (
"id" SERIAL,
"name" VARCHAR(50) NOT NULL,
"surname" VARCHAR(50) NOT NULL,
"department_id" INTEGER,
"salary" DECIMAL(15,2) NOT NULL,
PRIMARY KEY ("id")
);
INSERT INTO "users"
( "name", "surname", "department_id", "salary")
VALUES
('John', 'Stewart', 1, '3512.00'),
('Chris', 'Brown', 2, '1344.00'),
('Kate', 'Lewis', 3, '6574.00'),
('Ailisa', 'Gomez', NULL, '6500.00'),
('Gwendolyn', 'James', 2, '4200.00'),
('Simon', 'Cousersllins', 4, '3320.00'),
('Taylor', 'Martin', 2, '1500.00'),
('Andrew', 'Thompson', NULL, '2100.00');
TABLE 8
DROP TABLE IF EXISTS "users";
CREATE TABLE "users" (
"id" SERIAL,
"name" VARCHAR(50) NOT NULL,
"surname" VARCHAR(50) NOT NULL,
"email" VARCHAR(50),
PRIMARY KEY ("id")
);
INSERT INTO "users"
( "name", "surname", "email")
VALUES
('John', 'Stewart', 'john@email.com'),
('Chris', 'Brown', ''),
('Kate', 'Lewis',''),
('Ailisa', 'Gomez', 'ailisa@email.com'),
('Gwendolyn', 'James', ''),
('Simon', 'Collins', ''),
('Taylor', 'Martin',''),
('Andrew', 'Thompson', 'andrew123@email.com');
TABLE 9
DROP TABLE IF EXISTS "users";
CREATE TABLE "users" (
"id" SERIAL,
"name" VARCHAR(50) NOT NULL,
"surname" VARCHAR(50) NOT NULL,
"email" VARCHAR(100),
"department_id" INTEGER,
"salary" DECIMAL(15,2) NOT NULL,
PRIMARY KEY ("iusers_without_emaild")
);
INSERT INTO "users"
( "name", "surname", "email", "department_id", "salary")
VALUES
('John', 'Stewart', 'john@email.com', 1, '3512.00'),
('Chris', 'Brown', 'chris@email.com', 2, '1344.00'),
('Kate', 'Lewis', NULL, 3, '6574.00'),
('Ailisa', 'Gomez', 'ailisa@email.com', 2, '6500.00'),
('Gwendolyn', 'James', NULL, NULL, '4200.00'),
('Simon', 'Collins', NULL, 4, '3320.00'),
('Taylor', 'Martin', NULL, NULL, '1500.00'),
('Andrew', 'Thompson', 'andrew@email.com', NULL, '2100.00');
TABLE 10