Blame | Letzte Änderung | Log anzeigen | RSS feed
<sqlmap><select id="order-subtotal">SELECT"Order Details".OrderID as OrderID,Sum(("Order Details".UnitPrice*Quantity*(1-Discount)/100)*100) AS SubtotalFROM "Order Details"GROUP BY "Order Details".OrderID</select><!-- Show all the Cities we ship to or where a supplier is located --><select id="all-cities">SELECT City FROM SUPPLIERSUnionSELECT ShipCity FROM ORDERS</select><!-- Find Suppliers that supply the categories such as 'Produce', 'Seafood', 'Condiments' --><select id="suppliers-with" parameterClass="array">SELECT SupplierID, COUNT(P.CategoryID)FROM (SELECT DISTINCT SupplierID, CategoryID FROM Products) PINNER Join Categories C on C.CategoryID = P.CategoryIDWHERE CategoryName IN ('Produce', 'Seafood', 'Condiments')GROUP BY SupplierIDHAVING COUNT(P.CategoryID) =(SELECT COUNT(CategoryID)from CategoriesWHERE CategoryNameIN ('Produce', 'Seafood', 'Condiments'))</select><!-- Show Cities we ship to that also have a supplier located there --><select id="supplier-cities">SELECT DISTINCT ShipCity FROM ORDERSWHERE EXISTS (SELECT 1 from SUPPLIERS WHERE ShipCity = City)</select><!-- Show Cities we ship to that do not have a supplier located there --><select id="shipping-cities">SELECT DISTINCT ShipCity FROM ORDERSWHERE NOT EXISTS (SELECT 1 from SUPPLIERS WHERE ShipCity = City)</select><!-- Show all possible Supplier Product Combinations --><select id="supplier-products">SELECT * FROM Suppliers S CROSS Join Products</select><!-- Products over a certain unit price --><select id="products-with-price"><![CDATA[SELECTp.ProductName,c.CategoryName,p.UnitPriceFROM Products pINNER JOIN Categories c ONc.CategoryID = p.CategoryIDWHERE p.UnitPrice < #value#ORDER BY CategoryName ASC, UnitPrice ASC, ProductName ASC]]></select><!-- employee's manager's name and number of subordinates (if the employee has a manager) --><select id="employee-subordinates">SELECTEmployee.LastName,Employee.FirstName,Employee.NumberOfSubordinates,Manager.LastName as ManagerLastName,Manager.FirstName as ManagerFirstName,Manager.NumberOfSubordinates as ManagerNumberOfSubordinatesFROM EmployeeSubordinatesReport EmployeeLEFT JOIN EmployeeSubordinatesReport Manager ONEmployee.ReportsTo = Manager.EmployeeID</select><select id="pivot-test">SELECTo.customerID,c.CompanyName,p.productName,sum(od.quantity) as QtyFROM orders oINNER JOIN[order details] od on o.orderID = od.orderIDINNER JOINProducts p on od.ProductID = p.ProductIDINNER JOINCustomers c on o.CustomerID = c.CustomerIDGROUP BYo.customerID, c.CompanyName, p.ProductName</select><select id="employee-sales">SELECTe.firstName,c.CompanyName,COUNT(o.orderID)FROM Employees eJOIN Orders o ON e.employeeID=o.employeeIDJOIN Customers c ON c.customerID=o.customerIDGROUP BY e.firstName, c.CompanyNameORDER BY e.firstName, c.CompanyName</select></sqlmap>