Skip to content

Instantly share code, notes, and snippets.

@m1irka
Created May 15, 2026 08:43
Show Gist options
  • Select an option

  • Save m1irka/d3fd59f8e2ec24d2445b58d35ace2761 to your computer and use it in GitHub Desktop.

Select an option

Save m1irka/d3fd59f8e2ec24d2445b58d35ace2761 to your computer and use it in GitHub Desktop.
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,
Dean nvarchar(max) not null check (Dean <> ''),
Name nvarchar(100) not null unique check (Name <> '')
)
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 Teachers
(
Id int Identity(1,1) Primary Key,
EmploymentDate date not null check (EmploymentDate >= '1990-01-01'),
IsAssistant bit not null default 0,
IsProfessor bit not null default 0,
Name nvarchar(max) not null check (Name <> ''),
Position nvarchar(max) not null check (Position <> ''),
Premium money not null default 0 check (Premium >= 0),
Salary money not null check (Salary > 0),
Surname nvarchar(max) not null check (Surname <> '')
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment