795983e700309219bee5c18a0cf97cfe05e55143
API/CodeSamples/1-Million-Record-View.md
| ... | ... | @@ -4,6 +4,8 @@ |
| 4 | 4 | |
| 5 | 5 | Below is the SQL sample to create a View with 1 million records using the Northwind example database. This query can be used to load test your application with before you send it out to production. |
| 6 | 6 | |
| 7 | +##SQL Server |
|
| 8 | + |
|
| 7 | 9 | ```sql |
| 8 | 10 | CREATE View [1MOrders] AS |
| 9 | 11 | SELECT TOP 1000000 |
| ... | ... | @@ -38,4 +40,72 @@ JOIN [Order Details] ON [Order Details].[OrderID] = [Orders].[OrderID] |
| 38 | 40 | CROSS JOIN Products |
| 39 | 41 | CROSS JOIN Categories |
| 40 | 42 | GO |
| 43 | +``` |
|
| 44 | + |
|
| 45 | +##Oracle |
|
| 46 | + |
|
| 47 | +```sql |
|
| 48 | +DROP VIEW NORTHWIND."1MOrders"; |
|
| 49 | + |
|
| 50 | +CREATE OR REPLACE FORCE VIEW NORTHWIND."1MOrders" |
|
| 51 | +( |
|
| 52 | + "OrderID" |
|
| 53 | + ,"CustomerID" |
|
| 54 | + ,"OrderDate" |
|
| 55 | + ,"RequiredDate" |
|
| 56 | + ,"ShippedDate" |
|
| 57 | + ,"ShipVia" |
|
| 58 | + ,"Freight" |
|
| 59 | + ,"ShipName" |
|
| 60 | + ,"ShipAddress" |
|
| 61 | + ,"ShipCity" |
|
| 62 | + ,"ShipRegion" |
|
| 63 | + ,"ShipPostalCode" |
|
| 64 | + ,"ShipCountry" |
|
| 65 | + ,"UnitPrice" |
|
| 66 | + ,"Quantity" |
|
| 67 | + ,"Discount" |
|
| 68 | + ,"ProductID" |
|
| 69 | + ,"ProductName" |
|
| 70 | + ,"QuantityPerUnit" |
|
| 71 | + ,"UnitsInStock" |
|
| 72 | + ,"UnitsOnOrder" |
|
| 73 | + ,"ReorderLevel" |
|
| 74 | + ,"Discontinued" |
|
| 75 | + ,"CategoryName" |
|
| 76 | + ,"Description" |
|
| 77 | +) |
|
| 78 | +AS |
|
| 79 | + SELECT Orders.OrderID |
|
| 80 | + ,CustomerID |
|
| 81 | + ,OrderDate |
|
| 82 | + ,RequiredDate |
|
| 83 | + ,ShippedDate |
|
| 84 | + ,ShipVia |
|
| 85 | + ,Freight |
|
| 86 | + ,ShipName |
|
| 87 | + ,ShipAddress |
|
| 88 | + ,ShipCity |
|
| 89 | + ,ShipRegion |
|
| 90 | + ,ShipPostalCode |
|
| 91 | + ,ShipCountry |
|
| 92 | + ,Order_Details.UnitPrice |
|
| 93 | + ,Quantity |
|
| 94 | + ,Discount |
|
| 95 | + ,Products.ProductID |
|
| 96 | + ,ProductName |
|
| 97 | + ,QuantityPerUnit |
|
| 98 | + ,UnitsInStock |
|
| 99 | + ,UnitsOnOrder |
|
| 100 | + ,ReorderLevel |
|
| 101 | + ,Discontinued |
|
| 102 | + ,CategoryName |
|
| 103 | + ,Description |
|
| 104 | + FROM Orders |
|
| 105 | + JOIN "ORDER_DETAILS" ON "ORDER_DETAILS"."ORDERID" = "ORDERS"."ORDERID" |
|
| 106 | + CROSS JOIN PRODUCTS |
|
| 107 | + CROSS JOIN CATEGORIES |
|
| 108 | + where rownum <= 1000000; |
|
| 109 | + |
|
| 110 | +CREATE OR REPLACE SYNONYM NORTHWIND."Orders Qry" FOR NORTHWIND."1MOrders"; |
|
| 41 | 111 | ``` |
| ... | ... | \ No newline at end of file |