This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| CREATE TABLE Teacher ( | |
| Id INT IDENTITY(1,1) PRIMARY KEY, | |
| Name NVARCHAR(MAX) NOT NULL CHECK (Name <> ''), | |
| Surname NVARCHAR(MAX) NOT NULL CHECK (Surname <> '') | |
| ); | |
| CREATE TABLE Subject ( | |
| Id INT IDENTITY(1,1) PRIMARY KEY, | |
| Name NVARCHAR(100) NOT NULL UNIQUE CHECK (Name <> '') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| CREATE TABLE Curator ( | |
| Id INT IDENTITY(1,1) PRIMARY KEY, | |
| Name NVARCHAR(MAX) NOT NULL CHECK (Name <> ''), | |
| Surname NVARCHAR(MAX) NOT NULL CHECK (Surname <> '') | |
| ); | |
| CREATE TABLE Faculty ( | |
| Id INT IDENTITY(1,1) PRIMARY KEY, | |
| Financing MONEY NOT NULL CHECK (Financing >= 0) DEFAULT 0, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| CREATE DATABASE BarbershopDB; | |
| GO | |
| USE BarbershopDB; | |
| GO | |
| CREATE TABLE Barbers ( | |
| Id INT IDENTITY(1,1) PRIMARY KEY, | |
| FullName NVARCHAR(200) NOT NULL, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| CREATE TABLE Faculties ( | |
| Id INT IDENTITY(1,1) PRIMARY KEY, | |
| Financing MONEY NOT NULL CHECK (Financing >= 0) DEFAULT 0, | |
| Name NVARCHAR(100) NOT NULL UNIQUE CHECK (LEN(Name) > 0) | |
| ); | |
| CREATE TABLE Departments ( | |
| Id INT IDENTITY(1,1) PRIMARY KEY, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| CREATE TABLE Barbers ( | |
| Id INT IDENTITY(1,1) PRIMARY KEY, | |
| FullName NVARCHAR(200) NOT NULL CHECK (FullName <> ''), | |
| Gender NVARCHAR(10) NOT NULL CHECK (Gender IN ('Male','Female')), | |
| Phone NVARCHAR(20) NOT NULL UNIQUE, | |
| Email NVARCHAR(100) NOT NULL UNIQUE, | |
| BirthDate DATE NOT NULL, | |
| HireDate DATE NOT NULL, | |
| Position NVARCHAR(20) NOT NULL CHECK (Position IN ('Chief','Senior','Junior')) | |
| ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| CREATE TABLE Departments ( | |
| Id INT PRIMARY KEY IDENTITY(1,1) NOT NULL, | |
| Financing MONEY NOT NULL CHECK (Financing >= 0) DEFAULT 0, | |
| Name NVARCHAR(100) NOT NULL UNIQUE, | |
| FacultyId INT NOT NULL | |
| ); | |
| CREATE TABLE Faculties ( | |
| Id INT PRIMARY KEY IDENTITY(1,1) NOT NULL, | |
| Name NVARCHAR(100) NOT NULL UNIQUE |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| CREATE TABLE Faculty ( | |
| Id INT IDENTITY(1,1) PRIMARY KEY, | |
| Name NVARCHAR(100) NOT NULL UNIQUE CHECK (Name <> '') | |
| ); | |
| CREATE TABLE Department ( | |
| Id INT IDENTITY(1,1) PRIMARY KEY, | |
| Building INT NOT NULL CHECK (Building BETWEEN 1 AND 5), | |
| Financing MONEY NOT NULL CHECK (Financing >= 0) DEFAULT 0, | |
| Name NVARCHAR(100) NOT NULL UNIQUE CHECK (Name <> ''), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| CREATE TABLE Teachers ( | |
| Id INT PRIMARY KEY IDENTITY(1,1), | |
| Name NVARCHAR(MAX) NOT NULL, | |
| Surname NVARCHAR(MAX) NOT NULL | |
| ); | |
| CREATE TABLE Assistants ( | |
| Id INT PRIMARY KEY IDENTITY(1,1), | |
| TeacherId INT NOT NULL FOREIGN KEY REFERENCES Teachers(Id) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Create Table Departments | |
| ( | |
| Id int Identity(1,1) Primary Key, | |
| Financing money not null default 0 check (Financing >= 0), | |
| Name nvarchar(100) not null unique check (Name <> '') | |
| ) | |
| Create Table Faculties | |
| ( | |
| Id int Identity(1,1) Primary Key, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Create Table Groups | |
| ( | |
| Id int Identity(1,1) Primary Key, | |
| Name nvarchar(10) not null unique check (Name <> ''), | |
| Rating int not null check (Rating between 0 and 5), | |
| Year int not null check (Year between 1 and 5) | |
| ) | |
| Create Table Departments | |
| ( |
NewerOlder