Advertisement
Teammasik

laba_1_BD_initialBuild

Sep 29th, 2023 (edited)
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MySQL 1.33 KB | Cybersecurity | 0 0
  1. CREATE TABLE Company (
  2.    Company_id TINYINT PRIMARY KEY IDENTITY (1, 1),
  3.    Name VARCHAR(20),
  4.    Short_name VARCHAR(10),
  5.    City VARCHAR(15),
  6.    Coefficent TINYINT
  7. )
  8.  
  9. CREATE TABLE Cooperator (
  10.    Cooperator_id TINYINT PRIMARY KEY IDENTITY (1, 1),
  11.    Surname VARCHAR(15),
  12.    Name VARCHAR(15),
  13.    Bitrhday DATE,
  14.    City VARCHAR(15),
  15.    Salary DECIMAL,
  16.    Category VARCHAR(30),
  17.    Start_date DATE,
  18.    Dept_id TINYINT,
  19.    Phone_number VARCHAR(12),
  20.    Passport_num VARCHAR(12),
  21.    CONSTRAINT FK_Dept_id FOREIGN KEY (Dept_id) REFERENCES Department(Dept_id)
  22. )
  23.  
  24. CREATE TABLE Department_head (
  25.    Dept_head_id TINYINT PRIMARY KEY IDENTITY (1, 1),
  26.    Name VARCHAR(15),
  27.    Surname VARCHAR(15),
  28.    City VARCHAR(15),
  29. )
  30.  
  31. CREATE TABLE Department (
  32.    Dept_id TINYINT PRIMARY KEY IDENTITY (1, 1),
  33.    Name VARCHAR(15),
  34.    Short_name VARCHAR(15),
  35.    Hours tinyint,
  36.    Dept_head_id tinyint,
  37.    Company_id tinyint,
  38.    CONSTRAINT FK_Dept_head_id FOREIGN KEY (Dept_head_id) REFERENCES Department_head(Dept_head_id),
  39.    CONSTRAINT FK_Company_id FOREIGN KEY (Company_id) REFERENCES Company(Company_id)
  40. )
  41.  
  42. CREATE TABLE Evaluation (
  43.    Eval_id TINYINT PRIMARY KEY IDENTITY (1, 1),
  44.    Cooperator_id tinyint,
  45.    Status decimal,
  46.    Date date,
  47.    CONSTRAINT FK_Cooperator_id FOREIGN KEY (Cooperator_id) REFERENCES Cooperator(Cooperator_id)
  48. )
  49.  
  50.  
  51.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement