Uploaded by Mah Ru

Database Lab

advertisement
1. Customers from Portland.
Query Code:
select * from Customer
where city = 'portland';
Number of records retrieved against this query = 2
2. Customer first name and last name, for all customers.
Query Code:
select FirstName ,LastName from Customer;
Page |1
Number of records retrieved against this query = 91
3. Union on Order.CustomerId and Customer.Id for all entity occurrences in Order
and Customer.
Query Code:
select CustomerId from [Order]
union
select Id from [Customer];
Page |2
Number of records retrieved against this query = 91
4. Intersect on Order.CustomerId and Customer.Id for all entity occurrences in Order
and Customer.
Query Code:
select CustomerId from [Order]
intersect
select Id from [Customer];
Page |3
Number of records retrieved against this query = 89
5. Product on customer first name and last name.
Query Code:
select f.FirstName, l.LastName from Customer as f, Customer as l;
Page |4
Number of records retrieved against this query = 8281
6. Inner Join on Customer.Id and Order.CustomerId.
Query Code:
select * from [Customer] c
inner join [Order] o on c.id=o.CustomerId;
Page |5
Number of records retrieved against this query = 830
Page |6
Download