IT Assignment
IT Assignment
Class: 10th
Section: E
Roll Number: 10
Table Structure
Department Table Structure:
Location VARCHAR(5
0)
This table is used to store the details of various departments within an organization.
It includes a unique identifier for each department (Department ID), the name of the
department (Department Name), and its location. This structure ensures that each
department's information is easily accessible and manageable.
Employee Table Structure:
Salary DECIMAL(10,
2)
1 IT New York
2 HR Los
Angeles
3 Finance Chicago
The Employee table data contains details of four employees, including their ID,
name, email, phone number, salary, and the department they are working in. This
table helps to track employee information efficiently.
DDL Commands (Data Definition Language):
Create Table (Department):
“CREATE TABLE Department (
Department ID INT PRIMARY KEY,
Department Name VARCHAR(50) NOT NULL,
Location VARCHAR(50)
);”
This command creates the Department table with columns for Department ID,
Department Name, and Location. It ensures that the DepartmentID column serves
as the unique identifier for each department.
Create Table (Employee):
“CREATE TABLE Employee (
Employee ID INT PRIMARY KEY,
First Name VARCHAR(50) NOT NULL,
Last Name VARCHAR(50),
Email VARCHAR(100) UNIQUE NOT NULL,
Phone VARCHAR(15) UNIQUE,
Salary DECIMAL(10, 2),
Department ID INT,
FOREIGN KEY (Department ID) REFERENCES Department(Department
ID)
);”
This command creates the Employee table with all necessary columns, including a
foreign key to ensure that each employee is associated with a valid department.
Report:
SQL Query to Display Employee Details with Department and Location:
“SELECT
e.EmployeeID, e.FirstName, e.LastName, e.Email, e.Phone, e.Salary,
d.DepartmentName, d.Location
FROM Employee e
JOIN Department d ON e.DepartmentID = d.DepartmentID
ORDER BY d.DepartmentName, e.FirstName;”
This query retrieves detailed information about employees, including their
associated department and location, sorted by department and employee names.
Forms:
To manage data effectively, forms can be created for inserting data into
the Employee and Department tables. These forms provide a user-friendly
interface for adding new records to the database. For example, an HTML
form can include fields for all relevant data points, ensuring that all
required fields are completed before submission.
Department Form:
Employee Form:
Thank You!
References:
1. MongoDB Documentation: https://www.mongodb.com/docs/
2. W3Schools SQL Tutorial: https://www.w3schools.com/sql/
3. PostgreSQL Documentation: https://www.postgresql.org/docs/
The references listed above provide comprehensive information on
database design, SQL commands, and best practices for managing
databases. These resources were instrumental in preparing this
assignment.