1 select * from books;
2 select * from author;
3 select isbn,title from books;
4 select firstname,lastname,address from customers;
5 select category as "种类",title "书名" from books;
6 select retail-cost as "利润" from books;
7 select cost*1.1 as "newCost" from books;
8 select cost*1.1 as "newCost" from books order by cost asc;
9 select state from customers order by state asc;
10 select distinct state from customers order by state asc;
11 select unique state,firstname from customers order by state asc;
12 select distinct city,state from customers order by city asc;
13 select firstname||' ' ||lastname as "姓名" from customers;
14 select lname||','||fname from author;
15
16 chaper 4
17 select * from books where category='COMPUTER';
18 select * from customers where state = 'CA' order by customer# asc;
19
20 select isbn,title,cost from books where cost>20 order by cost;
21 select isbn,title,retail-cost from books where retail-cost>10 order by retail-cost;
22
23 select * from books where ISBN='1915762492';
24
25 select pubdate from books where pubdate='21-1月 06';
26 select pubdate from books where pubdate=TO_DATE('2006/1/21','YYYY/MM/DD');
27 select pubdate ,to_char(pubdate,'YYYY-MM-DD') from books;
28
29 select distinct state from customers where state != 'FL' order by state;
30 select distinct state from customers where state >='FA' order by state ;
31
32 select * from books where cost between 19 and 30 order by cost;
33 select * from customers where state in ('FL','CA');
34 select * from books where category in ('COOKING','COMPUTER') order by category;
35
36
37 Create view newbooks (title) as select title from books;
38 select title from newbooks;
39 DROP VIEW newbooks;
40
41 select table_name from tabs;
42 select table_name from all_tables;