Assignment 1 mandatory
Assignment 1 mandatory
use mandassignment1and2
ALTER TABLE Salesman ADD CONSTRAINT DF_City DEFAULT 'Unknown' FOR City;
--3. Fetch the data where the Customer s name is ending with N also get the
purchase amount value greater than 500.
/*5. Display the below columns which has the matching data.
Orderdate, Salesman Name, Customer Name, Commission, and City which has the range
of Purchase Amount between 500 to 1500.*/
SELECT O.OrderDate, S.Name, C.CustomerName, S.Commission, S.City,
C.PurchaseAmount FROM Orders O
JOIN Salesman S ON O.SalesmanId = S.SalesmanId
JOIN Customer C ON O.CustomerId = C.CustomerId
WHERE C.PurchaseAmount BETWEEN 500 AND 1500;
--6. Using right join fetch all the results from salesman orders table.