0% found this document useful (0 votes)
21 views1 page

Assignment 5

Uploaded by

rohit rajput
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views1 page

Assignment 5

Uploaded by

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

USE Assignment_2;

-- 1. Arrange the ‘Orders’ dataset in decreasing order of amount

SELECT * FROM Cust_Order


ORDER BY Amount DESC;

-- 2. Create a table with the name ‘Employee_details1’ consisting of these


columns: ‘Emp_id’, ‘Emp_name’, ‘Emp_salary’.
-- Create another table with the name ‘Employee_details2’ consisting of the
same columns as the first table.

CREATE TABLE Employee_details1 (Emp_id INT PRIMARY KEY, Emp_name VARCHAR(25)


NOT NULL, Emp_salary INT);

CREATE TABLE Employee_details2 (Emp_id INT PRIMARY KEY, Emp_name VARCHAR(25)


NOT NULL, Emp_salary INT);

SELECT * FROM Employee_details1;

SELECT * FROM Employee_details2;

INSERT INTO Employee_details1 (Emp_id, Emp_name, Emp_salary) VALUES


(1001, 'Nikhil Jain', 750000),
(1002, 'MD Ayaan', 760000),
(1003, 'Rajneesh', 600000),
(1004, 'Amit Sharma', 360000),
(1005, 'Nishant Tyagi', 720000)

INSERT INTO Employee_details2 (Emp_id, Emp_name, Emp_salary) VALUES


(1001, 'Shankar', 280000),
(1002, 'Giradhar J', 300000),
(1003, 'Ashok Teja', 480000),
(1004, 'Amit Sharma', 360000),
(1005, 'Nishant Tyagi', 720000)

UPDATE Employee_details2
SET Emp_id= 2003 WHERE Emp_name= 'Ashok Teja'

-- 3. Apply the UNION operator on these two tables

SELECT * FROM Employee_details1


UNION
SELECT * FROM Employee_details2

-- 4. Apply the INTERSECT operator on these two tables

SELECT * FROM Employee_details1


INTERSECT
SELECT * FROM Employee_details2

-- 5. Apply the EXCEPT operator on these two tables

SELECT * FROM Employee_details1


EXCEPT
SELECT * FROM Employee_details2

You might also like