Lab-4 & 5
Lab-4 & 5
USE employee_db;
INSERT INTO employees (name, department, age, gender, salary, address) VALUES
('John Smith', 'HR', 30, 'Male', 50000, '123 Main St, City, State, Zip'),
('Jane Doe', 'IT', 35, 'Female', 60000, '456 Elm St, City, State, Zip'),
('Michael Johnson', 'Sales', 28, 'Male', 55000, '789 Oak St, City, State, Zip'),
('Emily Brown', 'Marketing', 32, 'Female', 52000, '101 Pine St, City, State, Zip'),
('David Jones', 'Finance', 40, 'Male', 70000, '234 Cedar St, City, State, Zip'),
('Jessica Wilson', 'HR', 33, 'Female', 58000, '567 Maple St, City, State, Zip'),
('Daniel Lee', 'IT', 29, 'Male', 65000, '890 Birch St, City, State, Zip'),
('Jennifer Martinez', 'Sales', 31, 'Female', 60000, '111 Spruce St, City, State, Zip'),
('Christopher Taylor', 'Marketing', 36, 'Male', 62000, '222 Walnut St, City, State, Zip'),
('Sarah Anderson', 'Finance', 38, 'Female', 75000, '333 Pine St, City, State, Zip'),
('Robert Wilson', 'HR', 45, 'Male', 80000, '444 Oak St, City, State, Zip'),
('Emma Garcia', 'IT', 27, 'Female', 53000, '555 Elm St, City, State, Zip'),
('William Martinez', 'Sales', 34, 'Male', 67000, '666 Maple St, City, State, Zip'),
('Sophia Thomas', 'Marketing', 29, 'Female', 54000, '777 Cedar St, City, State, Zip'),
('James Brown', 'Finance', 42, 'Male', 72000, '888 Pine St, City, State, Zip');
SELECT * FROM employees;
INSERT INTO Std_Mark (RegNo, Name, Dept, OS, SW, CG, IOT) VALUES
(101, 'John Doe', 'Computer Science', 85, 78, 90, 88),
(102, 'Jane Smith', 'Computer Science'', 70, 80, 75, 85),
(103, 'Alice Johnson', 'Information Technology', 90, 85, 88, 92),
(104, 'Bob Brown', 'Computer Science', 82, 75, 80, 85),
(105, 'Emma Lee', 'Computer Science', 88, 90, 85, 87),
(106, 'Michael Johnson', 'Computer Science', 75, 80, 70, 78),
(107, 'Sarah Williams', 'Computer Science', 85, 75, 78, 80),
(108, 'David Miller', 'Information Technology', 92, 88, 90, 85),
(109, 'Olivia Taylor', 'Computer Science', 78, 85, 80, 75),
(110, 'Ethan Martinez', 'Computer Science', 85, 90, 82, 88),
(111, 'Sophia Anderson', 'Computer Science', 90, 82, 85, 88),
(112, 'Liam Wilson', 'Computer Science', 80, 85, 75, 82),
(113, 'Ava Thompson', 'Information Technology', 88, 92, 85, 90),
(114, 'Noah Garcia', 'Computer Science', 82, 78, 85, 80),
(115, 'Isabella Hernandez', 'Computer Science', 90, 85, 88, 92);
SELECT COUNT(*) AS Total_Students FROM Std_Mark;
Left Outer Join: Returns all rows from the left table (Student), and the matched rows from the
right table (Staff). If there is no match, NULL values are returned for the right table columns.
Right Outer Join: Returns all rows from the right table (Staff), and the matched rows from the
left table (Student). If there is no match, NULL values are returned for the left table columns.
Full Outer Join (Not supported in MySQL directly, but can be simulated using UNION of Left
and Right Outer Joins):
Cross Join: Returns the Cartesian product of the two tables, i.e., all possible combinations of
rows from both tables.