Skip to content

Commit

Permalink
Sample Files
Browse files Browse the repository at this point in the history
COMMIT added to Oracle scripts where INSERT/UPDATE/DELETE are performed
for client compatibility where autocommit is not used.
  • Loading branch information
bclothier committed Sep 2, 2016
1 parent 25a05d0 commit 3973c26
Show file tree
Hide file tree
Showing 27 changed files with 58 additions and 13 deletions.
2 changes: 1 addition & 1 deletion Oracle/Chapter 01/Listing 1.003.sql
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@ VALUES (Authors_Sequence.NEXTVAL, 'Ben', NULL, 'Clothier', '2015', 'Monterey St.
INSERT INTO Authors ( AuthorID, AuthFirst, AuthMid, AuthLast, AuthStNum, AuthStreet, AuthCity, AuthStProv, AuthPostal, AuthCountry )
VALUES (Authors_Sequence.NEXTVAL, 'Tom', NULL, 'Wickerath', '2317', '185th Place NE', 'Redmond', 'WA', '98052', 'USA');


COMMIT;
4 changes: 3 additions & 1 deletion Oracle/Chapter 04/Listing 4.021.sql
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,6 @@ INSERT INTO ProgramLogs (LogID, LogUserID, LogDate, Logger, LogLevel, LogMessage
INSERT INTO ProgramLogs (LogID, LogUserID, LogDate, Logger, LogLevel, LogMessage) VALUES (7, 'Ben', DATE '2016-07-05', 'ABC', '3', 'It''s been a while since an error was logged. System will now crash.');
INSERT INTO ProgramLogs (LogID, LogUserID, LogDate, Logger, LogLevel, LogMessage) VALUES (8, 'Ben', TIMESTAMP '2016-07-05 00:03:35', 'EFG', '4', 'User error. Please replace user.');
INSERT INTO ProgramLogs (LogID, LogUserID, LogDate, Logger, LogLevel, LogMessage) VALUES (9, 'John',TIMESTAMP '2016-07-05 08:10:02', 'EFG', '3', 'An unknown error has occurred. The error is unknown because the guy who wrote this part of the code quit a while back and he was like real real smart and the rest of us aren''t sure how it works.');
INSERT INTO ProgramLogs (LogID, LogUserID, LogDate, Logger, LogLevel, LogMessage) VALUES (10, 'Doug', TIMESTAMP '2016-07-05 12:32:01', 'XYZ', '4', 'User error. It''s not our fault!');
INSERT INTO ProgramLogs (LogID, LogUserID, LogDate, Logger, LogLevel, LogMessage) VALUES (10, 'Doug', TIMESTAMP '2016-07-05 12:32:01', 'XYZ', '4', 'User error. It''s not our fault!');

COMMIT;
4 changes: 3 additions & 1 deletion Oracle/Chapter 09/Listing 9.020.sql
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,6 @@ INSERT INTO Appointments (ApptStartDate, ApptStartTime, ApptEndDate, ApptEndTime
INSERT INTO Appointments (ApptStartDate, ApptStartTime, ApptEndDate, ApptEndTime, ApptDescription) VALUES (DATE '2017-01-03', INTERVAL '0 11:15' DAY TO MINUTE, DATE '2017-01-03', INTERVAL '0 12:00' DAY TO MINUTE, 'Design cover page');
INSERT INTO Appointments (ApptStartDate, ApptStartTime, ApptEndDate, ApptEndTime, ApptDescription) VALUES (DATE '2017-01-05', INTERVAL '0 09:00' DAY TO MINUTE, DATE '2017-01-05', INTERVAL '0 15:00' DAY TO MINUTE, 'Teach SQL course');
INSERT INTO Appointments (ApptStartDate, ApptStartTime, ApptEndDate, ApptEndTime, ApptDescription) VALUES (DATE '2017-01-05', INTERVAL '0 15:30' DAY TO MINUTE, DATE '2017-01-05', INTERVAL '0 16:30' DAY TO MINUTE, 'Review with Ben');
INSERT INTO Appointments (ApptStartDate, ApptStartTime, ApptEndDate, ApptEndTime, ApptDescription) VALUES (DATE '2017-01-06', INTERVAL '0 10:00' DAY TO MINUTE, DATE '2017-01-06', INTERVAL '0 11:30' DAY TO MINUTE, 'Plan for lunch');
INSERT INTO Appointments (ApptStartDate, ApptStartTime, ApptEndDate, ApptEndTime, ApptDescription) VALUES (DATE '2017-01-06', INTERVAL '0 10:00' DAY TO MINUTE, DATE '2017-01-06', INTERVAL '0 11:30' DAY TO MINUTE, 'Plan for lunch');

COMMIT;
4 changes: 3 additions & 1 deletion Oracle/Chapter 09/Listing 9.021.sql
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,6 @@ WITH SeqNumTbl(SeqNum) AS (
WHERE SeqNum < ADD_MONTHS(TRUNC(SYSDATE, 'YEAR'), 24) - ADD_MONTHS(TRUNC(SYSDATE, 'YEAR'), 12)
)
SELECT ADD_MONTHS(TRUNC(SYSDATE, 'YEAR'), 12) + SeqNum - TO_DATE('15-10-1582', 'DD-MM-YYYY'), ADD_MONTHS(TRUNC(SYSDATE, 'YEAR'), 12) + SeqNum
FROM SeqNumTbl;
FROM SeqNumTbl;

COMMIT;
1 change: 1 addition & 0 deletions Oracle/Chapter 10/Listing 10.001.sql
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,4 @@ VALUES (11, 'Mariam Davis', 'Developer', 8);
INSERT INTO Employees (EmployeeID, EmpName, EmpPosition, SupervisorID)
VALUES (12, 'Jessica Yosef', 'Developer', 8);

COMMIT;
2 changes: 2 additions & 0 deletions Oracle/Chapter 10/Listing 10.002.sql
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ ALTER SESSION SET CURRENT_SCHEMA = Item58Example;

UPDATE Employees SET SupervisorID = 5 WHERE EmployeeID = 4;
UPDATE Employees SET SupervisorID = 3 WHERE EmployeeID = 2;

COMMIT;
1 change: 1 addition & 0 deletions Oracle/Chapter 10/Listing 10.004.sql
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,4 @@ VALUES (11, 'Mariam Davis', 'Developer', 8, 16, 17);
INSERT INTO Employees (EmployeeID, EmpName, EmpPosition, SupervisorID, lft, rgt)
VALUES (12, 'Jessica Yosef', 'Developer', 8, 18, 19);

COMMIT;
2 changes: 2 additions & 0 deletions Oracle/Chapter 10/Listing 10.007.sql
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,5 @@ INSERT INTO Employees (EmployeeID, EmpName, EmpPosition, SupervisorID, Hierarchy
VALUES (11, 'Mariam Davis', 'Developer', 8, '1/3/8/11');
INSERT INTO Employees (EmployeeID, EmpName, EmpPosition, SupervisorID, HierarchyPath)
VALUES (12, 'Jessica Yosef', 'Developer', 8, '1/3/8/12');

COMMIT;
2 changes: 2 additions & 0 deletions Oracle/Chapter 10/Listing 10.010.sql
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,5 @@ INSERT INTO EmployeesAncestry (SupervisedEmployeeID, SupervisingEmployeeID, Dist
INSERT INTO EmployeesAncestry (SupervisedEmployeeID, SupervisingEmployeeID, Distance) VALUES (12, 3, 2);
INSERT INTO EmployeesAncestry (SupervisedEmployeeID, SupervisingEmployeeID, Distance) VALUES (12, 8, 1);
INSERT INTO EmployeesAncestry (SupervisedEmployeeID, SupervisingEmployeeID, Distance) VALUES (12, 12, 0);

COMMIT;
1 change: 1 addition & 0 deletions Oracle/Sample Databases/BeerStylesData.sql
Original file line number Diff line number Diff line change
Expand Up @@ -109,4 +109,5 @@ INSERT INTO Styles (StyleID, CategoryFK, CountryFK, StyleNm, ColourLowNb, Colour
INSERT INTO Styles (StyleID, CategoryFK, CountryFK, StyleNm, ColourLowNb, ColourHighNb, ABVLowNb, ABVHighNb, IBULowNb, IBUHighNb) VALUES (88, 4, 9, 'Imperial and Hyper Beers', 8, 55, 7, 40, 30, 100);
INSERT INTO Styles (StyleID, CategoryFK, CountryFK, StyleNm, ColourLowNb, ColourHighNb, ABVLowNb, ABVHighNb, IBULowNb, IBUHighNb) VALUES (89, 4, 9, 'American Stout', 30, 40, 5, 12, 35, 75);

COMMIT;

2 changes: 2 additions & 0 deletions Oracle/Sample Databases/BowlingLeagueData.sql
Original file line number Diff line number Diff line change
Expand Up @@ -7035,3 +7035,5 @@ INSERT INTO ztblWeeks
INSERT INTO ztblWeeks
(WeekStart, WeekEnd)
VALUES (DATE '2017-12-24', DATE '2017-12-30');

COMMIT;
2 changes: 2 additions & 0 deletions Oracle/Sample Databases/EntertainmentAgencyData.sql
Original file line number Diff line number Diff line change
Expand Up @@ -5549,3 +5549,5 @@ INSERT INTO ztblWeeks
INSERT INTO ztblWeeks
(WeekStart, WeekEnd)
VALUES (DATE '2017-12-24', DATE '2017-12-30');

COMMIT;
2 changes: 2 additions & 0 deletions Oracle/Sample Databases/Item02StructureAndData.sql
Original file line number Diff line number Diff line change
Expand Up @@ -100,3 +100,5 @@ INSERT INTO SalesTransactions (SalesID, CustomerID, ModelID, SalesPersonID, Purc
VALUES (5, 5, 5, 1, DATE '2015-11-10');
INSERT INTO SalesTransactions (SalesID, CustomerID, ModelID, SalesPersonID, PurchaseDate)
VALUES (6, 2, 6, 4, DATE '2015-05-25');

COMMIT;
2 changes: 1 addition & 1 deletion Oracle/Sample Databases/Item03StructureAndData.sql
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,4 @@ INSERT INTO Predecessors (PredecessorID, DrawingID, PredecessorNo, Predecessor)
INSERT INTO Predecessors (PredecessorID, DrawingID, PredecessorNo, Predecessor) VALUES (18, 6, 1, 'LS02388421');
INSERT INTO Predecessors (PredecessorID, DrawingID, PredecessorNo, Predecessor) VALUES (19, 6, 2, 'LS02769390');


COMMIT;
2 changes: 2 additions & 0 deletions Oracle/Sample Databases/Item04StructureAndData.sql
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,5 @@ VALUES ('Ben Clothier', '2015 Monterey St, San Antonio, TX 78207, USA');

INSERT INTO AuthorsUnnormalized (AuthName, AuthAddress)
VALUES ('Tom Wickerath', '2317 185th Place NE, Redmond, WA 98052, USA');

COMMIT;
2 changes: 2 additions & 0 deletions Oracle/Sample Databases/Item18StructureAndData.sql
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,5 @@ INSERT INTO Assignments (ID, DrawingNumber, Predecessor_1, Predecessor_2, Predec
INSERT INTO Assignments (ID, DrawingNumber, Predecessor_1, Predecessor_2, Predecessor_3, Predecessor_4, Predecessor_5) VALUES (4, 'LO873W1842-2', 'LS02388419', 'LS02741454', 'LS02741456', 'LS02769388', NULL);
INSERT INTO Assignments (ID, DrawingNumber, Predecessor_1, Predecessor_2, Predecessor_3, Predecessor_4, Predecessor_5) VALUES (5, 'LO690W1960-1', 'LS02742130', NULL, NULL, NULL, NULL);
INSERT INTO Assignments (ID, DrawingNumber, Predecessor_1, Predecessor_2, Predecessor_3, Predecessor_4, Predecessor_5) VALUES (6, 'LO217W1855-1', 'LS02388421', 'LS02769390', NULL, NULL, NULL);

COMMIT;
2 changes: 2 additions & 0 deletions Oracle/Sample Databases/Item19Data.sql
Original file line number Diff line number Diff line change
Expand Up @@ -86,3 +86,5 @@ INSERT INTO tblPostSales
VALUES ('Waffle Crisp', 54848.83, 72186.11, 86645.39,
56091.47, 89987.16, 34255.94, 75158.62, 49626.76,
62366.5, 88372.43, 76222.8, 65562.71);

COMMIT;
4 changes: 3 additions & 1 deletion Oracle/Sample Databases/Item21StructureAndData.sql
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,6 @@ INSERT INTO SalesSummary (Category, OctQuantity, OctSales, NovQuantity, NovSales
INSERT INTO SalesSummary (Category, OctQuantity, OctSales, NovQuantity, NovSales, DecQuantity, DecSales, JanQuantity, JanSales, FebQuantity, FebSales) VALUES ('Clothing', 145, 5903.2, 141, 5149.96, 139, 4937.74, 153, 5042.62, 136, 5913.98);
INSERT INTO SalesSummary (Category, OctQuantity, OctSales, NovQuantity, NovSales, DecQuantity, DecSales, JanQuantity, JanSales, FebQuantity, FebSales) VALUES ('Components', 286, 34228.55, 322, 35451.79, 265, 27480.22, 325, 35151.97, 307, 32828.02);
INSERT INTO SalesSummary (Category, OctQuantity, OctSales, NovQuantity, NovSales, DecQuantity, DecSales, JanQuantity, JanSales, FebQuantity, FebSales) VALUES ('Skateboards', 164, 60530.06, 203, 89040.58, 129, 59377.2, 204, 79461.3, 147, 61125.19);
INSERT INTO SalesSummary (Category, OctQuantity, OctSales, NovQuantity, NovSales, DecQuantity, DecSales, JanQuantity, JanSales, FebQuantity, FebSales) VALUES ('Tires', 151, 4356.91, 110, 3081.24, 150, 4388.55, 186, 5377.6, 137, 3937.7);
INSERT INTO SalesSummary (Category, OctQuantity, OctSales, NovQuantity, NovSales, DecQuantity, DecSales, JanQuantity, JanSales, FebQuantity, FebSales) VALUES ('Tires', 151, 4356.91, 110, 3081.24, 150, 4388.55, 186, 5377.6, 137, 3937.7);

COMMIT;
4 changes: 3 additions & 1 deletion Oracle/Sample Databases/Item30StructureAndData.sql
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,6 @@ CREATE TABLE Inventory (
INSERT INTO Inventory (Color, Dimension, Quantity) VALUES ('Red', 'L', 10);
INSERT INTO Inventory (Color, Dimension, Quantity) VALUES ('Blue', 'M', 20);
INSERT INTO Inventory (Color, Dimension, Quantity) VALUES ('Red', 'M', 15);
INSERT INTO Inventory (Color, Dimension, Quantity) VALUES ('Blue', 'L', 5);
INSERT INTO Inventory (Color, Dimension, Quantity) VALUES ('Blue', 'L', 5);

COMMIT;
4 changes: 3 additions & 1 deletion Oracle/Sample Databases/Item33StructureAndData.sql
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,6 @@ INSERT INTO BeerStyles (Category, Country, Style, MaxABV) VALUES ('European Ales
INSERT INTO BeerStyles (Category, Country, Style, MaxABV) VALUES ('American Beers', 'United States', 'American Barley Wine', 12);
INSERT INTO BeerStyles (Category, Country, Style, MaxABV) VALUES ('American Beers', 'United States', 'American Stout', 11.5);
INSERT INTO BeerStyles (Category, Country, Style, MaxABV) VALUES ('European Ales', 'Germany', 'Dunkelweizen', 6);
INSERT INTO BeerStyles (Category, Country, Style, MaxABV) VALUES ('European Ales', 'France', 'Bi�re de Garde', 8.5);
INSERT INTO BeerStyles (Category, Country, Style, MaxABV) VALUES ('European Ales', 'France', 'Bi�re de Garde', 8.5);

COMMIT;
1 change: 1 addition & 0 deletions Oracle/Sample Databases/Item36StructureAndData.sql
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,4 @@ INSERT INTO OrdersTable (OrderNumber, OrderDate, ShipDate, CustomerID, EmployeeI
INSERT INTO OrdersTable (OrderNumber, OrderDate, ShipDate, CustomerID, EmployeeID, OrderTotal) VALUES (22, DATE '2012-09-03', DATE '2012-09-07', 1026, 702, 6456.16);
INSERT INTO OrdersTable (OrderNumber, OrderDate, ShipDate, CustomerID, EmployeeID, OrderTotal) VALUES (19, DATE '2012-09-02', DATE '2012-09-06', 1027, 707, 15278.98);

COMMIT;
4 changes: 3 additions & 1 deletion Oracle/Sample Databases/Item39StructureAndData.sql
Original file line number Diff line number Diff line change
Expand Up @@ -10025,4 +10025,6 @@ INSERT INTO Purchases (PurchaseID, CustomerID, PurchaseDate, PurchaseAmount) VAL
INSERT INTO Purchases (PurchaseID, CustomerID, PurchaseDate, PurchaseAmount) VALUES (9997, 4, DATE '2014-02-03', 875.1250);
INSERT INTO Purchases (PurchaseID, CustomerID, PurchaseDate, PurchaseAmount) VALUES (9998, 10, DATE '2015-08-13', 929.2459);
INSERT INTO Purchases (PurchaseID, CustomerID, PurchaseDate, PurchaseAmount) VALUES (9999, 6, DATE '2014-12-28', 997.4141);
INSERT INTO Purchases (PurchaseID, CustomerID, PurchaseDate, PurchaseAmount) VALUES (10000, 6, DATE '2012-08-08', 106.7603);
INSERT INTO Purchases (PurchaseID, CustomerID, PurchaseDate, PurchaseAmount) VALUES (10000, 6, DATE '2012-08-08', 106.7603);

COMMIT;
4 changes: 3 additions & 1 deletion Oracle/Sample Databases/Item52StructureAndData.sql
Original file line number Diff line number Diff line change
Expand Up @@ -148,4 +148,6 @@ INSERT INTO Tally (Num) VALUES (96);
INSERT INTO Tally (Num) VALUES (97);
INSERT INTO Tally (Num) VALUES (98);
INSERT INTO Tally (Num) VALUES (99);
INSERT INTO Tally (Num) VALUES (100);
INSERT INTO Tally (Num) VALUES (100);

COMMIT;
Loading

0 comments on commit 3973c26

Please sign in to comment.