Professional Documents
Culture Documents
BTH số 9 Vũ Hoàng Anh - 20021492
BTH số 9 Vũ Hoàng Anh - 20021492
BTH số 9 Vũ Hoàng Anh - 20021492
Vũ Hoàng Anh_20021492
Câu 1 : Thực hành các lệnh INSERT, UPDATE và DELETE trên các bảng
trong hình dưới đây của CSDL classicmodels.
NSERT INTO productlines (productLine, textDescription)
VALUES (‘Iphone 10’, ‘FRAGILE, PLEASE HANDLE WITH CARE’);
INSERT INTO productlines (productLine, textDescription)
VALUES (‘Iphone 11’, ‘FRAGILE, PLEASE HANDLE WITH CARE’);
INSERT INTO productlines (productLine, textDescription)
VALUES (‘Iphone 11 Plus’, ‘SALE OF 25%’);
UPDATE productlines
SET textDescription = “OUT OF ORDER”
WHERE productLine = ‘Iphone 11’;
products
INSERT INTO products
(productCode, productName, productLine, productScale,
productVendor, productDescription, quantityInStock, buyPrice)
VALUES (‘S101’, ‘Telephone’, ‘Iphone 10’, ‘1:1’, ‘PRO’, ‘None’, 5, 1000);
INSERT INTO products
(productCode, productName, productLine, productScale,
productVendor, productDescription, quantityInStock, buyPrice)
VALUES (‘S102’, ‘Telephone’, ‘Iphone 11’, ‘1:1’, ‘PRO’, ‘None’, 3, 1500);
INSERT INTO products
(productCode, productName, productLine, productScale,
productVendor, productDescription, quantityInStock, buyPrice)
VALUES (‘S103’, ‘Telephone’, ‘Iphone 11 Plus’, ‘1:1’, ‘PRO’, ‘None’, 4, 2000);
UPDATE products
SET quantityStock = ‘6’
WHERE productCode = ‘S102’;
orders
INSERT INTO orders (orderNumber, orderDate, requiredDate, shippedDate, status,
comments, customerNumber )
VALUES (1, ‘2020-05-13’, ‘2020-05-25’, ‘2020-05-20’, ‘Shipped’, null, 11 );
INSERT INTO orders (orderNumber, orderDate, requiredDate, shippedDate, status,
comments, customerNumber )
VALUES (2, ‘2020-06-13’, ‘2020-05-27’, ‘2020-05-19’, ‘Cancel’, null, 12 );
INSERT INTO orders (orderNumber, orderDate, requiredDate, shippedDate, status,
comments, customerNumber )
VALUES (3, ‘2020-07-13’, ‘2020-05-24’, ‘2020-05-18’, ‘Shipped’, null, 13 );
UPDATE orders
SET status = ‘Cancel’
WHERE orderNumber = 3;
orderdetails
INSERT INTO orderdetails (orderNumber, productCode, quantityOrdered, priceEach,
orderLineNumber)
VALUES (‘1’, ‘S101′, ’10’, ‘500’, ‘6’);
INSERT INTO orderdetails (orderNumber, productCode, quantityOrdered, priceEach,
orderLineNumber)
VALUES (‘2’, ‘S102’, ‘9’, ‘265’, ‘7’);
INSERT INTO orderdetails (orderNumber, productCode, quantityOrdered, priceEach,
orderLineNumber)
VALUES (‘3’, ‘S103′, ’11’, ‘300’, ‘8’);
UPDATE orderdetails
SET priceEach = ‘501’
WHERE orderNumber = ‘1’;
Câu 3 : Sửa các nhân viên có titleJob là ‘Sales Rep’ thành ‘Sales
Representative’
USE classicmodels;
UPDATE employees
SET jobTitle = ‘Sales Representative’
WHERE jobTitle = ‘Sales Rep’;