Я новичок в oracle, и я экспериментирую с различными кодами. Я практиковал sql в рабочих листах oracle live sql и quick sql Shorthand.Краткая инструкция SQL предоставила готовый код для отделов и сотрудников, где я не понимаю эту строку , где employee.department_id =partments.id .Я не понимаю столбец .id , поскольку при создании таблицы отделов столбец .id не создается.Это столбец отдела (pkey), который автоматически генерируется с помощью ссылки на внешний ключ в таблице «Сотрудники»? Или это псевдоколонка.
Я встречал псевдостолбец строки в документации Oracle OXL.
Это КОД
create table departments (
name varchar2(255) not null,
location varchar2(4000),
country varchar2(4000)
)
;
create table employees (
department_id number
constraint employees_department_id_fk
references departments on delete cascade,
name varchar2(50) not null,
email varchar2(255),
cost_center number,
date_hired date,
job varchar2(255)
)
;
-- triggers
create or replace trigger departments_biu
before insert or update
on departments
for each row
begin
null;
end departments_biu;
/
create or replace trigger employees_biu
before insert or update
on employees
for each row
begin
:new.email := lower(:new.email);
end employees_biu;
/
-- indexes
create index employees_i1 on employees (department_id);
-- create views
create or replace view emp_v as
select
departments.name department_name,
departments.location location,
departments.country country,
employees.name employee_name,
employees.email email,
employees.cost_center cost_center,
employees.date_hired date_hired,
employees.job job
from
departments,
employees
where
*employees.department_id(+) = departments.id;*
/
-- load data
insert into departments (
name,
location,
country
) values (
'Government Sales',
'Tanquecitos',
'United States'
);
insert into departments (
name,
location,
country
) values (
'Security',
'Sugarloaf',
'United States'
);
insert into departments (
name,
location,
country
) values (
'Finance',
'Dale City',
'United States'
);
insert into departments (
name,
location,
country
) values (
'Customer Support',
'Grosvenor',
'United States'
);
commit;
-- load data
insert into employees (
department_id,
name,
email,
cost_center,
date_hired,
job
) values (
1,
'Gricelda Luebbers',
'gricelda.luebbers@aaab.com',
76,
sysdate - 63,
'Engineer'
);
insert into employees (
department_id,
name,
email,
cost_center,
date_hired,
job
) values (
1,
'Dean Bollich',
'dean.bollich@aaac.com',
35,
sysdate - 93,
'Security Specialist'
);
insert into employees (
department_id,
name,
email,
cost_center,
date_hired,
job
) values (
1,
'Milo Manoni',
'milo.manoni@aaad.com',
100,
sysdate - 90,
'Marketing Manager'
);
insert into employees (
department_id,
name,
email,
cost_center,
date_hired,
job
) values (
1,
'Laurice Karl',
'laurice.karl@aaae.com',
43,
sysdate - 16,
'Accounting Analyst'
);
insert into employees (
department_id,
name,
email,
cost_center,
date_hired,
job
) values (
1,
'August Rupel',
'august.rupel@aaaf.com',
66,
sysdate - 44,
'President'
);
insert into employees (
department_id,
name,
email,
cost_center,
date_hired,
job
) values (
1,
'Salome Guisti',
'salome.guisti@aaag.com',
11,
sysdate - 70,
'Sales Representative'
);
insert into employees (
department_id,
name,
email,
cost_center,
date_hired,
job
) values (
1,
'Lovie Ritacco',
'lovie.ritacco@aaah.com',
7,
sysdate - 18,
'Sales Representative'
);
insert into employees (
department_id,
name,
email,
cost_center,
date_hired,
job
) values (
1,
'Chaya Greczkowski',
'chaya.greczkowski@aaai.com',
21,
sysdate - 33,
'Data Architect'
);
insert into employees (
department_id,
name,
email,
cost_center,
date_hired,
job
) values (
1,
'Twila Coolbeth',
'twila.coolbeth@aaaj.com',
9,
sysdate - 95,
'Webmaster'
);
insert into employees (
department_id,
name,
email,
cost_center,
date_hired,
job
) values (
1,
'Carlotta Achenbach',
'carlotta.achenbach@aaak.com',
51,
sysdate - 82,
'Security Specialist'
);
insert into employees (
department_id,
name,
email,
cost_center,
date_hired,
job
) values (
1,
'Jeraldine Audet',
'jeraldine.audet@aaal.com',
54,
sysdate - 12,
'Help Desk Specialist'
);
insert into employees (
department_id,
name,
email,
cost_center,
date_hired,
job
) values (
1,
'August Arouri',
'august.arouri@aaam.com',
32,
sysdate - 26,
'Marketing Manager'
);
insert into employees (
department_id,
name,
email,
cost_center,
date_hired,
job
) values (
1,
'Ward Stepney',
'ward.stepney@aaan.com',
8,
sysdate - 62,
'Business Applications'
);
insert into employees (
department_id,
name,
email,
cost_center,
date_hired,
job
) values (
1,
'Ayana Barkhurst',
'ayana.barkhurst@aaao.com',
25,
sysdate - 93,
'Webmaster'
);
commit;
ЧТО ТАКОЕ столбец .id в коде?