我一直停留在這個問題上一會兒 ,這裏是有方向插入數據
客戶誰已被邀請沒有「蒙娜麗莎」 gala_night現在就邀請到5 -jan-2014蒙娜麗莎gala_night。顯示插入命令和生成的Invite表。
這裏是兩個表
SQL> select * from invite;
GALA_DATE PAINTING_NAME CUSTID
----------- ---------------------- ----------
10-nov-2013 Watercolors 1430
15-nov-2013 Woman 1502
15-nov-2013 Woman 1619
05-dec-2013 Watercolors 1207
22-dec-2013 Sunflowers 1806
22-dec-2013 Sunflowers 1904
31-dec-2013 Fiddler 1236
31-dec-2013 Fiddler 1280
05-jan-2014 Mona_Lisa 1111
05-jan-2014 Mona_Lisa 1502
25-jan-2014 Madonna 1806
25-jan-2014 Madonna 1822
25-jan-2014 Madonna 1904
18-feb-2014 Maya 1619
18-feb-2014 Maya 1822
18-feb-2014 Maya 1904
28-feb-2014 Mona_Lisa 1502
30-apr-2014 Lovers 1207
30-apr-2014 Lovers 1280
30-apr-2014 Lovers 1822
30-apr-2014 Lovers 1904
SQL> select * from customer;
CUSTID CUSTNAME CUSTBDATE CUST_TYPE BENEFACTOR DOCENT
1301 Disney 01-nov-1980 NM No No
1806 Garcia 31-dec-2000 VIP Yes No
1502 LaGardia 15-jan-1960 VIP Yes Yes
1207 Perry 20-jan-1960 VIP Yes Yes
1280 Beecham 31-dec-1979 VIP Yes No
1822 Becker 30-jan-1967 VIP Yes Yes
1140 Klim 05-apr-1990 NM No No
1509 Roberts 21-jul-1989 VIP Yes No
1619 Robins 20-feb-1990 VIP Yes Yes
1111 Bardot 28-feb-1970 VIP No No
1515 David 18-apr-1980 NM No No
1701 Martin 20-aug-1972 RM No No
1904 Gross 30-sep-1975 VIP Yes Yes
1236 Brooks 23-sep-1975 VIP Yes No
1430 Todd 15-jul-1982 VIP Yes Yes
我試着做創建
insert into invite(gala_date,painting_name,custid)
select invite.gala_date,invite.painting_name,invite.custid
from invite,customer
where invite.gala_date='05 Jan 2014' and invite.painting_name='Mona_Lisa'
and customer.custid=invite.custid
and customer.custid not in
(select custid from invite where gala_date in('05 Jan 2014')
and painting_name in('Mona_Lisa'));
0行。
但是,正如你所看到的結果產量「0行創建」 任何想法? 謝謝!
非常感謝你! – user3016699