-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtables_setup.sql
More file actions
30 lines (26 loc) · 838 Bytes
/
tables_setup.sql
File metadata and controls
30 lines (26 loc) · 838 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
-- Creating a table for employees
CREATE TABLE employees (
employee_id INT PRIMARY KEY AUTO_INCREMENT,
first_name VARCHAR(50) NOT NULL,
last_name VARCHAR(50) NOT NULL,
email VARCHAR(100) UNIQUE NOT NULL,
phone_number VARCHAR(20),
hire_date DATE NOT NULL,
job_title VARCHAR(50),
department_id INT,
salary DECIMAL(10, 2)
);
-- Creating a table for departments
CREATE TABLE departments (
department_id INT PRIMARY KEY AUTO_INCREMENT,
department_name VARCHAR(100) NOT NULL,
manager_id INT
);
-- Creating a table for attendance records
CREATE TABLE attendance (
attendance_id INT PRIMARY KEY AUTO_INCREMENT,
employee_id INT,
attendance_date DATE,
status ENUM('Present', 'Absent', 'Leave') DEFAULT 'Present',
FOREIGN KEY (employee_id) REFERENCES employees(employee_id)
);