Scaffold-DbContext "Server=.;Database=Var1;Trusted_Connection=True;TrustServerCertificate=True;" Microsoft.EntityFrameworkCore.SqlServer
int identity(1,1) primary key
����� ������� ������ ����� ����� ������ �������. ������ �������� ���������
����:
���������� ���������� ����� � �������
��� ���������� ������� � ������������ ������� ������������ alter table
alter table �������
add �������� ������� ��� �������
������ ���������� ������� � ��������� ������:
alter table Client
add ID int identity(1,1) primary key
��, �� ����� ������ �� ������ ��������, �� ������� ���� ��������� �����. ������
������������ ������� � ��������, ����� ���������. Identity �������� � ��� ��� �����������
������.
���� ����� ������� ��� ������������ ���� (��� ���������) ��������� ������,
����� ���������������
alter table �������
add primary key (������������ ��������)
������ �������� �� id
� ����� ������ ����� ������� ����� ������� � ����������� �� ������ �������, ��
� ������ � ��������, � ����� �������� � �� ���������� ��������� �������:
insert into ����� ������� (���� ����� �������)
select ������� � ID.ID, ������ �������.������, ������� �����������
from ������ �������, ������� � ID
where ������ �������.�������� = ������� � ID.��������
������ ��� ������ ���� ��������:
insert into ClientService (ClientID, StartTime, ServiceID)
select client.ID, client_service_import.[������ �������� ������], [Service].ID
from client_service_import, Client, [Service]
where client_service_import.[������] = client.LastName
and client_service_import.[������] = [Service].Title
������� ������ � ������������ �������
���� ������ ������������, ��������, ����� ���� ���� ������ � ������ ��� �������,
����, ���� ���� �����/������� ��� ��� ��������, ����� ��� ��������� � ����� ������� ���
������.
insert into ����� ������� (���� �������)
select (��������������� ���� �������) from ������� � ��������
������ �������:
insert into [Service] (Title, DurationInSeconds, Cost, Discount)
select * from service_b_import
���������� �������� �����
���������� �������� ����� � ������������ ������� �������� ����� �������
alter table
alter table �������� �������
add foreign key �������� ������� references ������ �������(�������� �������)
������:
alter table Invoice
add foreign key (CustomerID) references Customer(CustomerID)