-
Notifications
You must be signed in to change notification settings - Fork 0
/
oracle_lessons_2.sql
66 lines (43 loc) · 1.22 KB
/
oracle_lessons_2.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
---- Oracle Dersleri 2-------
select * from employees;
create table calisan as (select * from employees);
select * from calisan;
desc calisan;
drop table calisan;
select * from recyclebin;
flashback table calisan to before drop;
alter table calisan
add constraint salary_min check (salary > 1500);---kısıt kontrol.
INSERT INTO calısan (
employee_ıd,
fırst_name,
last_name,
emaıl,
phone_number,
hıre_date,
job_ıd,
salary,
commıssıon_pct,
manager_ıd,
department_ıd
) VALUES (
207 ,
'Steven',
'King',
'SKING',
'515.123.4567',
'17/06/1987',
'AD_PRES',
1700,
null,
null,
90);
------
select * from USER_CONSTRAINTS where table_name= 'CALISAN';
alter table calisan drop constraint salary_min; ----kısıtın silinmesi
select * from calisan;
alter table calisan add ( toplam_id as (manager_id + department_id)); ---sanal kolun
create table calisan_ek as (select employee_id as id , first_name as adi, salary as maas from calisan where 1= 2);
insert into calisan_ek (id, adi, maas)
select employee_id , first_name, salary from calisan;
update calisan_ek set adi = '&adi' where maas = '&maas'; ---- dısardan data alır.