e08e8d18778e6aed5ac5a3800cffc9640a52ad12
CodeSamples/Changing-Decimal-Precision.md
| ... | ... | @@ -0,0 +1,111 @@ |
| 1 | +#1 Million Record View |
|
| 2 | + |
|
| 3 | +##About |
|
| 4 | + |
|
| 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 | + |
|
| 7 | +##SQL Server |
|
| 8 | + |
|
| 9 | +```sql |
|
| 10 | +CREATE View [1MOrders] AS |
|
| 11 | +SELECT TOP 1000000 |
|
| 12 | + [Orders].[OrderID] |
|
| 13 | + ,[CustomerID] |
|
| 14 | + ,[OrderDate] |
|
| 15 | + ,[RequiredDate] |
|
| 16 | + ,[ShippedDate] |
|
| 17 | + ,[ShipVia] |
|
| 18 | + ,[Freight] |
|
| 19 | + ,[ShipName] |
|
| 20 | + ,[ShipAddress] |
|
| 21 | + ,[ShipCity] |
|
| 22 | + ,[ShipRegion] |
|
| 23 | + ,[ShipPostalCode] |
|
| 24 | + ,[ShipCountry] |
|
| 25 | + ,[Order Details].[UnitPrice] |
|
| 26 | + ,[Quantity] |
|
| 27 | + ,[Discount] |
|
| 28 | + ,[Products].[ProductID] |
|
| 29 | + ,[ProductName] |
|
| 30 | + ,[QuantityPerUnit] |
|
| 31 | + ,[UnitsInStock] |
|
| 32 | + ,[UnitsOnOrder] |
|
| 33 | + ,[ReorderLevel] |
|
| 34 | + ,[Discontinued] |
|
| 35 | + ,[CategoryName] |
|
| 36 | + ,[Description] |
|
| 37 | + |
|
| 38 | +FROM Orders |
|
| 39 | +JOIN [Order Details] ON [Order Details].[OrderID] = [Orders].[OrderID] |
|
| 40 | +CROSS JOIN Products |
|
| 41 | +CROSS JOIN Categories |
|
| 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"; |
|
| 111 | +``` |
|
| ... | ... | \ No newline at end of file |