Базы данных
Моделирование баз данных
| Обозначение | Свойство |
|---|---|
| «M» | Обязательная |
| «O» | Необязательная |
| «PK» | Основной ключ |
| подчёркивание | Основной ключ |
| «Kn» | Дополнительный ключ n |
create type Address as (
city varchar(30),
street varchar(30),
...
)
| Обозначение | Свойство |
|---|---|
| «M» | Обязательный |
| «O» | Необязательный |
| «PK» | Основной ключ |
| «Kn» | Дополнительный ключ n |

class Student {
int Id;
string FirstName, LastName;
Group group inverse Group::students;
}
class Group {
int Id;
Set<Student> students inverse Student::group;
}
create table Persons (
id int,
name varchar(50)
);
primary key (id)
primary key (passport_series, passport_no)
constraint person_pk primary key (id)
unique (id)
unique primary key (passport_series, passport_no)
constraint person_uniq unique (id)
constraint student_group_fk foreign key (groupId) references groups(id)
foreign key (passport_series, passport_no) references passports(passport_series, passport_no)
drop table persons;
drop table students, groups;
alter table person add column birthday date;
alter table person change birthday timestamp not null;
alter table student drop constraint student_group_fk;
drop type Address;