The ORDER BY clause’s purpose is to sort the query result by specific columns.
The GROUP BY clause’s purpose is summarize unique combinations of columns values.
SELECT SalesOrderID, ProductID, OrderQty* UnitPrice As ExtendedPrice FROM Sales.SalesOrderDetail ORDER BY SalesOrderID ELECT SalesOrderID, SUM(OrderQty* UnitPrice) As TotalPrice FROM Sales.SalesOrderDetail GROUP BY SalesOrderID INDEX The index is usually defined on one or more columns of a table. It has the ordered column and pointers to rows in the table. Indexes are the fastest way to access DB2 data. Indexes reduce search-time. A JOIN clause is used to combine rows from two or more tables, based on a related column between them. SELECT Orders.OrderID, Customers.CustomerName, Orders.OrderDate FROM Orders INNER JOIN Customers ON Orders.CustomerID=Customers.CustomerID; The LEFT JOIN keyword returns all records from the left table (table1), and the matched records from the right table (table2). The result is NULL from the right side, if there is no match. The RIGHT JOIN keyword returns all records from the right table (table2), and the matched records from the left table (table1). The result is NULL from the left side, when there is no match.
The PRIMARY KEY constraint uniquely identifies each record in a table.
foriegn key is aprimary key on another table (parent table)and that can be reffered in child table with othe column/same column
A table can have only one primary key, which may consist of one single or of multiple fields.