[DATABASE]SQL query examples

There are three relations used for this example - RENTAL_CUSTOMER, CAR, RENTAL. Below are the SQL statements used to create the relations. Data have been inserted to the relations: RENTAL_CUSTOMER CAR RENTAL List all cars rented by Smith since 1st of August 2017 List each make of the cars and the total number of cars … Continue reading [DATABASE]SQL query examples

[DATABASE] Difference between intersect and union

I have two relations namely PROPERTY and LEASE, see the PROPERTYNO attributes returned from PROPERTY and LEASE respectively: In intersect, tuples which exists in both relations will be displayed removing duplicates. In union, all tuples from property and all tuples from lease will be displayed removing duplicates:

[DATABASE]Difference between inner join, right and left outer join

Creating the tables Data from T1 Data from T2 Left outer join In the below example left table is T1 and right table is T2. Left outer join will cause tuples of the left table (T1) to be preserved, the right table (T2) will display values that match the TID of the left, if there … Continue reading [DATABASE]Difference between inner join, right and left outer join