Inserting Records - Exercise

Contact Us or call 1-877-932-8228
Inserting Records - Exercise

Inserting Records

Duration: 5 to 15 minutes.

In this exercise, you will practice inserting records.

  1. Insert yourself into the Employees table.
    • Include the following fields: LastName, FirstName, Title, TitleOfCourtesy, BirthDate, HireDate, City, Region, PostalCode, Country, HomePhone, ReportsTo
  2. Insert an order for yourself in the Orders table.
    • Include the following fields: CustomerID, EmployeeID, OrderDate, RequiredDate
  3. Insert order details in the Order_Details table.
    • Include the following fields: OrderID, ProductID, UnitPrice, Quantity, Discount

Solution:

InsertsUpdatesDeletes/Solutions/Inserts.sql
/******************************
Oracle Solution
******************************/
INSERT INTO Employees
(EmployeeID, LastName, FirstName, Title, TitleOfCourtesy, 
	BirthDate, HireDate, City, Region, 
	PostalCode, Country, HomePhone, ReportsTo)
VALUES(10, 'Dunn','Nat','Trainer','Mr.',
	'01-Feb-1970','04-Mar-1997','Jamesville','NY',
	'13078','USA','315-555-5555','1');

/******************************

SQL Server & MySQL Solution
******************************/
INSERT INTO Employees
(LastName, FirstName, Title, TitleOfCourtesy, 
	BirthDate, HireDate, City, Region, 
	PostalCode, Country, HomePhone, ReportsTo)
VALUES('Dunn','Nat','Trainer','Mr.',
	'1970-02-01','1997-03-04','Jamesville','NY',
	'13078','USA','315-555-5555','1');

/******************************

Oracle Solution
******************************/
INSERT INTO Orders
(OrderID, CustomerID, EmployeeID, OrderDate, RequiredDate)
VALUES(11078, 'COMMI',10,'24-May-2004','12-Jul-2005');

/******************************
SQL Server & MySQL Solution
******************************/
INSERT INTO Orders
(CustomerID, EmployeeID, OrderDate, RequiredDate)
VALUES('COMMI',10,'2005-05-24','2005-07-12');

INSERT INTO Order_Details
(OrderID, ProductID, UnitPrice, Quantity, Discount)
VALUES(11078, 3, 10, 100, .1);

/*
	SQL Server users will replace Order_Details with "Order Details"

*/
Next