阿摩線上測驗 登入

申論題資訊

試卷:104年 - 104 地方政府特種考試_四等_統計、資訊處理:資料處理概要#35522
科目:資料處理
年份:104年
排序:0

題組內容

二、考慮下列關聯式資料庫的三個 table:顧客(Customer)、產品(Product)和交易 (Transaction)。他們的結構(schema)定義如下:Customer(cName, cID, address)、 Product(pName, pID, price)、Transaction(cID, pID, amount)。 (每小題 10 分,共 20 分)

申論題內容

⑴顧客「李大同」要買產品「H 牌手機」一支,請寫出 SQL 指令來更新 table。

詳解 (共 2 筆)

詳解 提供者:牛奶鍋

insert into Transaction (cid, pid,amount)

select cid, pid, price
from customer, product  
where customer.cname='李大同' and product.pname='H牌手機’;
詳解 提供者:1990y11m17d
Insert into Transaction Select cID, (Select pID from Product Where pName = 'H牌手機'),1 From Custom Where cName='李大同'