CSQL에서 SQL 실행

csql을 실행하고 난 후에는 csql> 프롬프트에서 원하는 SQL문을 입력해서 실행할 수 있다. 하나의 SQL 문은 세미콜론(;)으로 끝나도록 입력하며, 여러 개의 SQL문을 한꺼번에 입력할 수도 있다. 입력된 SQL 문들을 실행하기 위해서는 ;x 세션 명령어를 사용한다. 세션 명령어는 ;help 명령으로 간단한 사용법을 찾아 볼 수 있으며 상세한 내용은 “세션 명령어”를 참고한다. 

% csql demodb
         CUBRID SQL 수행기

도움말 메시지를 보려면 ';help' 명령어를 입력하세요.
csql> select * from olympic;
csql> ;x
=== <SELECT의 결과, 명령어 라인 1> ===

    host_year  host_nation           host_city             opening_date  closing
_date  mascot                slogan                introduction
================================================================================
=======================================================================
         2004  'Greece'              'Athens'              08/13/2004    08/29/2
004    'Athena  Phevos'      'Welcome Home'        'In 2004 the Olympic Games re
turned to Greece,

the home of both the ancient Olympics and the first modern Olympics. For the fir
st time ever a record 201 National Olympic

Committees (NOCs) participated in the Olympic Games. The overall tally for event
s on the programme was 301 (one more than in

Sydney 2000). Popularity in the Games soared to new highs as 3.9 billion people
had access to the television coverage compared to

3.6 billion for Sydney 2000. Women''s wrestling was included in the program for
the first time. Swimmer Michael Phelps won 6

gold medals and set a single-Games record with 8 total medals. Leontien Ziljaard
-van Moorsel became the first female cyclist to

earn 4 career gold medals and 6 total medals, while canoeist Birgit Fischer beca
me the first athlete in any sport to win two

medals in each of 5 Olympics. Runner Hicham El Guerrouj won both the 1,500m and
the 5,000m, while on the women''s side Kelly

Holmes triumphed in both the 800m and the 1,500m. In team play, Argentina won th
e men''s football tournament without giving up a

goal, and the U.S. softball team won by outscoring their opponents 51-1.'
<중간 생략>
25 개의 열이 selected.

진행 중인 트랜잭션이 커밋 되었습니다.

1 개의 명령어가 실행되었습니다.
csql> SELECT SUM(n) FROM (SELECT gold FROM participant WHERE nation_code='KOR'
csql> UNION ALL SELECT silver FROM participant WHERE nation_code='JPN') AS t(n);
csql> ;x

=== <SELECT의 결과, 명령어 라인 1> ===

       sum(n)
=============
           82

1 개의 열이 selected.

진행 중인 트랜잭션이 커밋 되었습니다.

1 개의 명령어가 실행되었습니다.
csql> ;exit