0% found this document useful (0 votes)
113 views3 pages

Major Assignment: Sample Tables

The document describes a database assignment with four parts: 1. Create three tables, add sample data, and perform cross and inner joins. 2. Write left and right outer joins between two tables. 3. Add more data, write unions, and a full outer join. 4. Create stored procedures for selecting customers, a cross join, and a parameterized query.

Uploaded by

Atif basir khan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
113 views3 pages

Major Assignment: Sample Tables

The document describes a database assignment with four parts: 1. Create three tables, add sample data, and perform cross and inner joins. 2. Write left and right outer joins between two tables. 3. Add more data, write unions, and a full outer join. 4. Create stored procedures for selecting customers, a cross join, and a parameterized query.

Uploaded by

Atif basir khan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

MAJOR ASSIGNMENT

Total Marks: 10

SAMPLE TABLES

Table 1: “Salesman” Primary key & Auto increment.


Must start from your university id

Table 2: “Customer” Primary key & Auto increment.


Must start from your university id

Table 3: “Orders” Primary key & Auto increment.


Must start from your university id

Key Points:

 Create all the tables.


 Make 5 entries in each table
 1st column must be a primary key and auto increment.
 Primary key of each table must start from your university id.
Screenshots: (Total 6)

 First paste the screenshot of table creation query and then paste the screenshot of table
with entries. No need for the insert query screenshot.
 Do the same for all three tables.
PART 1
Key Points:

 Write the SQL statement to CROSS JOIN the three tables.


 Write the SQL statement to INNER JOIN the three tables.

Screenshots: (Total 2)

 1 screenshot of cross join with query.


 1 screenshot of inner join with query.

PART 2

Key Points:

 Write the SQL statement for LEFT JOIN between “Salesman” and “Customer”.
 Write the SQL statement for RIGHT JOIN between “Customer and “Salesman”.

Screenshots: (Total 2):

 1 screenshot for LEFT JOIN with query.


 1 screenshot for RIGHT JOIN with query.

PART 3

Key Points:

 Make further three entries in each of the “salesman” and “customer” table. Repeat
cities like Lahore and Peshawar.
 Write the SQL statement to make the UNION between “Salesman” and “Customer.
Identify salesman and customer.
 Write the SQL statement to make the UNION ALL between “Salesman” and “Customer.
Identify salesman and customer.
 Write the SQL statement to select ALL those customers and suppliers who belongs to
Lahore or Peshawar.
 Make the union between LEFT and Right Join tables of PART 2. (It is also called FULL JOIN)

Screenshots: (Total 4)

 Paste screen shot for each question with query.

PART 4
Key Points:

 Make a stored procedure to select all the records of “customer”.


 Make a store procedure for cross join between “salesman” and “orders”.
 Make a parameterized stored procedure to select 4th record from “salesman”.

Screenshots: (Total 4)

 1 screenshot of all the procedures you have made.


Hint:

 3 screenshots for each key point.

THE END

You might also like