0% found this document useful (0 votes)
12 views2 pages

USE Qlns

The document contains SQL commands to create a database schema for a human resources management system. It defines five tables: PhongBan (Departments), ChucVu (Positions), NhanVien (Employees), BangChamCong (Attendance), and Luong (Salary), with appropriate primary and foreign key relationships. This structure allows for the management of employee details, attendance, and salary information.
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)
12 views2 pages

USE Qlns

The document contains SQL commands to create a database schema for a human resources management system. It defines five tables: PhongBan (Departments), ChucVu (Positions), NhanVien (Employees), BangChamCong (Attendance), and Luong (Salary), with appropriate primary and foreign key relationships. This structure allows for the management of employee details, attendance, and salary information.
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/ 2

USE qlns;

CREATE TABLE IF NOT EXISTS PhongBan (

ma VARCHAR(255) PRIMARY KEY,

ten VARCHAR(255)

);

CREATE TABLE IF NOT EXISTS ChucVu (

ma VARCHAR(255) PRIMARY KEY,

ten VARCHAR(255)

);

CREATE TABLE IF NOT EXISTS NhanVien (

ma VARCHAR(255) PRIMARY KEY,

ten VARCHAR(255),

diachi VARCHAR(255),

sodienthoai VARCHAR(255),

tuoi INT,

gioitinh VARCHAR(50),

cmnd VARCHAR(255),

dantoc VARCHAR(255),

mapb VARCHAR(255),

macv VARCHAR(255),

FOREIGN KEY (mapb) REFERENCES PhongBan(ma),

FOREIGN KEY (macv) REFERENCES ChucVu(ma)

);
CREATE TABLE IF NOT EXISTS BangChamCong (

ma VARCHAR(255) PRIMARY KEY,

manv VARCHAR(255),

thang VARCHAR(255),

ngaylamviec INT,

thuong DECIMAL(10, 2),

FOREIGN KEY (manv) REFERENCES NhanVien(ma)

);

CREATE TABLE IF NOT EXISTS Luong (

ma VARCHAR(255) PRIMARY KEY,

manv VARCHAR(255),

thang VARCHAR(255),

luongcoban DECIMAL(10, 2),

tongluong DECIMAL(10, 2),

FOREIGN KEY (manv) REFERENCES NhanVien(ma)

);

You might also like