-
Notifications
You must be signed in to change notification settings - Fork 541
/
northwind.db_upgrade_1-2.sql
26 lines (26 loc) · 1.14 KB
/
northwind.db_upgrade_1-2.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
-- add a FullNames column to Employees
ALTER TABLE "Employees" RENAME TO 'Employees_ME_TMP';
CREATE TABLE "Employees" (
"EmployeeID" int NOT NULL,
"LastName" varchar(20) NOT NULL,
"FirstName" varchar(10) NOT NULL,
"Title" varchar(30),
"TitleOfCourtesy" varchar(25),
"BirthDate" timestamp,
"HireDate" timestamp,
"Address" varchar(60),
"City" varchar(15),
"Region" varchar(15),
"PostalCode" varchar(10),
"Country" varchar(15),
"HomePhone" varchar(24),
"Extension" varchar(4),
"Photo" blob,
"Notes" text,
"ReportsTo" int,
"PhotoPath" varchar(255),
"FullName" varchar(150),
PRIMARY KEY ("EmployeeID")
);
INSERT INTO "Employees" ("EmployeeID", "LastName", "FirstName", "Title", "TitleOfCourtesy", "BirthDate", "HireDate", "Address", "City", "Region", "PostalCode", "Country", "HomePhone", "Extension", "Photo", "Notes", "ReportsTo", "PhotoPath", "FullName") SELECT "EmployeeID", "LastName", "FirstName", "Title", "TitleOfCourtesy", "BirthDate", "HireDate", "Address", "City", "Region", "PostalCode", "Country", "HomePhone", "Extension", "Photo", "Notes", "ReportsTo", "PhotoPath", "FirstName" || ' ' || "LastName" FROM "Employees_ME_TMP";
DROP TABLE "Employees_ME_TMP";