|
第二章 函數篇File: BOOK select distinct * from book.dbf select distinct publisher, author from book (純粹查詢) select stm as register_no, ch_name as Chinese_name, En_name as English_name (取代名字) select bk_name , price * 0.8 as new_price from book (乘書價0.8) select upper (Author) as new_author, publisher from book (轉字大楷) select lower (Author) as new_author, publisher from book (轉字小楷)
Y= substr (2,2,3) (變數)
File: NUMBER sele x, int(x) as integer from number floor (x) as floor, ceiling (x) as ceiling sele s, val(s) as vale from number sele x, str(x,7,2) as str_7_2, str (x,5,0) as str_5_0, str(x,4) as str_4 from number File: STUDENT sele ch_name, class_no from student where en_dist (not) like ‘%Ma On Shan%’ (抄尋地方法) sele ….. from ….. where dob between {^07/02/77} and {^09/02/1977} (找尋日期法) sele ….. from ….. where …… between ‘C’ and ‘L’ /in (7,9) order by class_no (找尋變數法) sele ….. from ….. where en_name like ‘CHOI%’ or en_name like ‘Lai%’ File: Table2 Sele t, asc(t) as asc from table2
第一章 SQL基礎慨念以下只供作參考 :sele ch_name, cls_name, class_no, substr(stm, 1,7) + “(“+substr(stm,8,1)+”)” from student order by class_name sele count (*) from student where en_dist like ‘%HILL’ [hill大小楷要相等] sele count (en_name) as living_in_HILL from student where en_dist like in (‘SHATIN’) sele sex, count(*) from student group by sex sele en_dist count(*) from student en_dist like ‘%TAI%’ group sele * from student where cls_name = ‘6A’ File: COURSE sele sum (hour) from course sele sum (hour *2) from course where eng_name = ‘ Chinese(1)’ sele max/min (cour_num) from course where 後不可以用function
網址情報站 : (FOR Foxpro)
Quick Look JReference File: STUDENT
Function 1) sele …… from …… where ……. <= ‘ ‘ order by ….. [ increasing order] 2) sele …… from …… where ……. In (‘A’, ‘B’) [A, B are district] 3) sele …… from …… where ……. like ‘ ‘ [ Known that ‘=’ equal to ‘like’] 4) sele …… , count(*) from …… group by ……. [ count (*) means count all] 5) sele ……, sum( ) from ….. group by …… [ sum means add of total, different from count] 6) ….. . ….. [ (file) . (field) ] e.g. sele student.cls_name, student.sex , count (*) from student group by student.cls_name, student.sex What does it use for in 6? In case the field is from different file, Function 6 can help you. Supplementary of File: NUMBER 1*1à 1 2*2à 4 …. Command: sele n, n^2 as Power_of_2, (n^3 as Power of_3) from number 0.1à 0 1.1à 1 Command: sele x, int(x) as integer, round(x,1) as decil from number
Round( ) – as above FLOOR( ) – returns the lagerest integer less than the given no. INT( ) – returns only the integral part of a no. CEILING( ) – returns the smallest integer greater than the given no.
END P.S. Please do write the copyright is by :“ 不一樣的素” |