Dbms Raw File
Dbms Raw File
Dbms Raw File
Practical File
DBMS LAB
2. Draw ER Diagram
Code:
desc employee;
INSERT INTO EMPLOYEE (Fname, Minit, Lname, Ssn, Bdate, Address, Sex, Salary, Super_ssn, Dno)
VALUES
('John', 'B', 'Smith', '123456789', '1965-01-09', '731 Fondren, Houston, TX', 'M', 30000, '333445555', 5),
('Franklin', 'T', 'Wong', '333445555', '1955-12-08', '638 Voss, Houston, TX', 'M', 40000, '888665555', 5),
('Alicia', 'J', 'Zelaya', '999887777', '1968-01-19', '3321 Castle, Spring, TX', 'F', 25000, '987654321', 4),
('Jennifer', 'S', 'Wallace', '987654321', '1941-06-20', '291 Berry, Bellaire, TX', 'F', 43000, '888665555', 4),
('Ramesh', 'K', 'Narayan', '666884444', '1962-09-15', '975 Fire Oak, Humble, TX', 'M', 38000,
'333445555', 5),
('Joyce', 'A', 'English', '453453453', '1972-07-31', '5631 Rice, Houston, TX', 'F', 25000, '333445555', 5),
('Ahmad', 'V', 'Jabbar', '987987987', '1969-03-29', '980 Dallas, Houston, TX', 'M', 25000, '987654321', 4),
('James', 'E', 'Borg', '888665555', '1937-11-10', '450 Stone, Houston, TX', 'M', 55000, NULL, 1);
Output:
Queries:
1. Total number of employees
2. Average salary of all employees
3. Maximum hours worked on any project
4. Total hours worked across all projects
5. Number of employees in each department
6. Average salary by department
7. Total hours per project
8. Number of projects in each location
9. To determine the number of dependents each employee
10.To count the number of projects in each location
Code:
1. SELECT COUNT(*) AS TotalEmployees FROM EMPLOYEE;
Queries:
1. List all employees along with their department names, including those without a
department.
2. List all possible combinations of employees and departments.
3. List all employees and all departments
4. List all departments along with employee names, including departments without any
employees
5. List employees and their supervisors
6. List departments along with the count of employees in each
7. List employees, their projects, and the hours worked on each project
8. List project names along with employee names who work on them
9. List of departments with the number of employees and the average salary where
average salary is above a certain threshold (e.g., 35000)
10.Number of dependents per employee with their total salary
11.Average hours worked on projects by department
12.Total salaries paid by each department