
13:41:30 CALL userproc1('축구의 역사'); -- 고객별로 평균주문금액이 12000원이 넘는 고객이름, 주문번호, 평균금액을 보고싶음. SELECT name, AVG(saleprice), orderid FROM Orders, Customer WHERE Orders.custid=Customer.custid AND Orders.saleprice > 12000 GROUP BY Customer.custid; -- HAVING Orders.saleprice > 12000; select name, sum(saleprice) from customer, orders where customer.custid = orders.custid group by customer.custid; SELECT FROM Orders; SELECT FROM Customer; SELECT name, AVG(saleprice),orderid FROM Orders, Customer WHERE Orders.custid=Customer.custid GROUP BY Customer.custid HAVING Orders.saleprice > 12000; SELECT orderid, saleprice FROM orders WHERE saleprice > ALL (SELECT saleprice FROM Orders WHERE custid = '3'); select (select name from customer cs where cs.custid=od.custid) "name", sum(saleprice) "total" from orders od group by od.custid;
Error Code: 1055 Expression #3 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'madang.Orders.orderid' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
Error Code: 1055 Expression #3 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'madang.Orders.orderid' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by

테이블 수정, 삭제
ALTER TABLE 테이블명 쿼리를 이용
뷰 호출 => 정의가 된 sql 승인
view의 속성을 삭제하려면 view의 정의를 변경하는 CREATE OR REPLACE 문을 사용하면 된다.
=> 뷰의 정의를 변경해야!
부속질의 자체는 메인질의가 있고 어떤 정보를 가져오고 싶을때 부속질의를 덧붙여 사용.