1、1. 启动数据库的命令( A )。A.startupB.startup openC.shutdownD.startup database2. ( C )是启动数据库时用来记录数据文献、联机日记文献的相关信息的二进制文献。A.数据文献B.参数文献C.控制文献D.归档文献3. 你需要在表SALES里查找一些产品明细,其中PROD_ID列涉及字符_D123。( B )WHERE子句条件能得到这些相符产品。A. WHERE prod_id LIKE %_D123% ESCAPE _B. WHERE prod_id LIKE %_D123% ESCAPE C. WHERE prod_id LIKE %_
2、D123% ESCAPE %_D. WHERE prod_id LIKE %_D123% ESCAPE _4. 关于单行函数,哪一个描述是对的的?( D )A.他们只能接受一个参数。B.他们只能嵌套两层。C.参数只能是字段值或常量。D.他们始终为查找表中的每个行返回一个值。5. 下面哪个SQL语句显示1890.55 as $1,890.55?( ADE )选三项A. SELECT TO_CHAR(1890.55,$0G000D00)FROM DUAL;B. SELECT TO_CHAR(1890.55,$9,999V99)FROM DUAL;C. SELECT TO_CHAR(1890.55,
3、$99,999D99)FROM DUAL;D. SELECT TO_CHAR(1890.55,$99G999D00) FROM DUAL;E. SELECT TO_CHAR(1890.55,$99G999D99)FROM DUAL;6. 下列关于ORACLE的to_date函数和to_char函数,描述对的的是( BC )选两项A.to_char函数是将字符串数据转换为日期数据B.to_date函数是将字符串数据转换为日期数据C.to_char函数是将日期数据转换为字符数据D.to_date函数是将日期数据转换为字符数据7. 在表emp里,计算员工的年薪SAL*12并生成别名Annual Sa
4、lary。( B )A.SELECT ename,sal*12, Annual Salary FROM emp;B.SELECT ename,sal*12 Annual Salary FROM emp;C.SELECT ename,sal*12 AS Annual Salary FROM emp;D.SELECT ename,sql*12 AS INICTAP(Annual Salary ) FROM emp;8. 查看promotion(促销表),每个促销周期为7天。你的经理要你生成一个报表,提供每周的促销成本。( D )A. SELECT promo_name, promo_cost/pr
5、omo_end_date-promo_begin_date/7 FROM promotions;B. SELECT promo_name,(promo_cost/promo_end_date-promo_begin_date)/7 FROM promotions;C. SELECT promo_name, promo_cost/(promo_end_date-promo_begin_date/7) FROM promotions;D. SELECT promo_name, promo_cost/(promo_end_date-promo_begin_date)/7) FROM promotio
6、ns;9. 你需要为每个客户的信息额度增长$1000。在输出时,客户的last name列头应为Name,cust_credit_limit的列头为New Credit Limit。( C )A. SELECT cust_last_name Name, cust_credit_limit + 1000New Credit LimitFROM customers;B. SELECT cust_last_name AS Name, cust_credit_limit + 1000AS New Credit LimitFROM customers;C. SELECT cust_last_name A
7、S Name, cust_credit_limit + 1000AS New Credit LimitFROM customers;D. SELECT INITCAP(cust_last_name) Name, cust_credit_limit + 1000 INITCAP(NEW CREDIT LIMIT) FROM customers;10. 查看表PRODUCTS。你需要生成一个报表显示如下格式:CATEGORIES5MP Digital Photo Cameras category is PhotoY Boxs category is ElectronicsEnvoy Ambassa
8、dors category is Hardware哪两个查询可以获得需要的输出?( CD )A. SELECT prod_name | qs category is | prod_category CATEGORIES FROM products;B. SELECT prod_name | qs category is | prod_category CATEGORIES FROM products;C. SELECT prod_name | qs | category is | prod_category CATEGORIES FROM products;D. SELECT prod_nam
9、e | q | category is | prod_category CATEGORIES FROM products;11. 下面查询:SQL SELECT cust_name AS NAME, cust_credit_limit/2 AS MIDPOINT,MIDPOINT+100 AS MAX LOWER LIMITFROM customers;上面查询在执行时发生错误,这个错误的因素是什么?( A )A.一个别名不能使用在表达式中。B.一个别名NAME没有一个隔开的双引号。C.MIDPOINT+100是错误的由于CUST_CREDIT_LIMIT包含了NULL值。D.为CUST_CR
10、EDIT_LIMIT/2表达式取一个别名MIDPOINT应用双引号隔开。12. 你想去生成一个报表显示每个员工从入职以来的总的薪金。你执行下列查询:SQLSELECT ename joined on hiredate, the total compensation paid is TO_CHAR(ROUND(ROUND(SYSDATE-hiredate)/365) * sal + comm)COMPENSATION UNTIL DATEFROM employees;输出结果:哪个说法是对的的?( C )A.此查询执行错误是由于别名无效的。B.此查询能对的执行并得到对的的结果。C.此查询能对的执
11、行但不能得到对的结果。D.此查询执行错误是由于ROUND函数是无效的。13. 当你执行下列查询:SQL select e.empno, e.ename, d.loc 2 from emp e, dept d 3 where e.deptno = d.deptno 4 and substr(e.ename, 1, 1) = S;下列哪个语句是Oracle数据库中可用的ANSI兼容等价语句?( A )Aselect empno, ename, loc from emp join dept on emp.deptno = dept.deptno where substr(emp.ename, 1,
12、1) = S; Bselect empno, ename, loc from emp, dept on emp.deptno = dept.deptno where substr(emp.ename, 1, 1) = S;Cselect empno, ename, loc from emp join dept where emp.deptno = dept.deptno and substr(emp.ename, 1, 1) = S;Dselect empno, ename, loc from emp left join dept on emp.deptno = dept.deptno and
13、 substr(emp.ename, 1, 1) = S;14. 你要操纵Oracle数据,下列哪个不是SQL命令?( B )Aselect * from dual; Bset defineCupdate emp set ename = 6543 where ename = SMITHERS;Dcreate table employees(empid varchar2(10) primary key);SQL *Plus中发出的下列语句: SQL select ceil(-97.342), 2 floor(-97.342), 3 round(-97.342), 4 trunc(-97.342)
14、 5 from dual;15. 下列哪个函数不返回结果-97?( B )Aceil() Bfloor() Cround() Dtrunc()16. 查看下面PROMOTIONS表结构:name Null TypePROMO_ID NOT NULL NUMBER(6)PROMO_NAME NOT NULL VARCHAR2(30)PROMO_CATEGORY NOT NULL VARCHAR2(30)PROMO_COST NOT NULL NUMBER(10,2管理层想看到每种促销种类的唯一促销成本。下面哪个查询得到需要的结果?( D )A. SELECT DISTINCT promo_cos
15、t, promo_category FROM promotions;B. SELECT promo_category, DISTINCT promo_cost FROM promotions;C. SELECT DISTINCT promo_cost, DISTINCT promo_category FROM promotions;D. SELECT DISTINCT promo_category, promo_cost FROM promotions ORDER BY 1;17. 在Oracle数据库10g/11g里哪三个关于数据类型描述对的的是?( ADE )A.每个表里只能有一个LONG
16、字段。B.一个TIMESTAMP数据类型字段只能存储带秒的时间值。C.BLOB数据类型字段用于在操作系统文献里存储二进制数据。D.可认为一个VARCHAR2数据类型列中指定的最小列宽为1E.一个CHAR数据类型列中的值是空格填充到最大定义的列宽18. 查看下面表EMP_DETAILS结构:name NULL TYPEEMP_ID NOT NULL NUMBEREMP_NAME NOT NULL VARCHAR2 (40)EMP_IMAGE LONG19. 哪两个SQL语句在表EMP_DETAILS执行是对的的?( BC )A.一个EMP_IMAGE字段能包含在GROUY BY子句。B.一个EM
17、P_IMAGE字段不能包含在ORDER BY子句。C.你不能在表中增长新的LONG字段。D.您可以更改表,涉及对EMP_IMAGE列的NOT NULL约束。20. 检查下列表结构:name Null TypeTRANS_ID NOT NULL NUMBER(6)CUST_NAME NOT NULL VARCHAR2(20)CUST_STATUS NOT NULL CHARTRANS_DATE NOT NULL DATETRANS_VALIDITY VARCHAR2CUST_CREDIT_LIMIT NUMBER在上面的表结构中创建和存储中哪些说法是对的的?( BC )选二项A.CUST_STA
18、TUS列将给犯错误。B.TRANS_VALIDITY列将给犯错误。C.CUST_STATUS列能存储一个字符。D.CUST_CREDIT_LIMIT列不能存储有小数位的值。E.TRANS_VALIDITY列最大长度为一个字符。F.TRANS_DATE列能存储天、月、世纪、年、小时、分、秒和秒的小数部分。21. 查看下面表TRANSACTIONS结构:name Null Type TRANS_ID NOT NULL NUMBER(6)CUST_NAME NOT NULL VARCHAR2(20)CUST_STATUS NOT NULL VARCHAR2TRANS_DATE NOT NULL DA
19、TETRANS_VALIDITY INTERVAL DAY TO SECONDCUST_CREDIT_VALUE NUMBER(10)22. 在上面的表结构中创建和存储中哪些说法是对的的?( BC )选二项A.TRANS_DATE列只允许存储格式为dd-mon-yyyy的日期。B.CUST_CREDIT_VALUE列允许存储正负整数。C.TRANS_VALIDITY列允许存储日、小时、分和秒间隔时间。D.CUST_STATUS列允许存储最大为4000字符。23. 下列哪个CREATE TABLE语法是有效的?( A )A. CREATE TABLE emp9$# (emp_no NUMBER
20、(4);B. CREATE TABLE 9emp$# (emp_no NUMBER(4);C. CREATE TABLE emp*123 (emp_no NUMBER(4);D. CREATE TABLE emp9$# (emp_no NUMBER(4), date DATE);24. 哪两个关于约束对的的说法?( BD )选二项A.外键不能包含NULL值。B.一个有UNIQUE约束的字段能包含NULL值。C.约束是只对一个表上的INSERT操作执行。D.约束能被禁用即使约束字段包含数据。E.所有的约束可以在列级定义,也可以在表级别定义。25. 评估下列CREATE TABLE命令:CREAT
21、E TABLE orders(ord_no NUMBER(2) CONSTRAINT ord_pk PRIMARY KEY,ord_date DATE,cust_id NUMBER(4);CREATE TABLE ord_items(ord_no NUMBER(2),item_no NUMBER(3),qty NUMBER(3) CHECK (qty BETWEEN 100 AND 200),expiry_date date CHECK (expiry_date SYSDATE),CONSTRAINT it_pk PRIMARY KEY (ord_no,item_no),CONSTRAINT
22、ord_fk FOREIGN KEY(ord_no) REFERENCES orders(ord_no);当执行上述命令时失败,因素是什么?( A )A.SYSDATE不能用于CHECK约束。B.BETWEEN子句不能用于CHECK约束。C.CHECK约束不能放在具有DATE数据类型的列。D.ORD_NO和ITEM_NO不能用于复合主键由于ORD_NO也是外键。26. 评估下列SQL命名:SQLCREATE SEQUENCE ord_seqINCREMENT BY 10START WITH 120MAXVALUE 9999NOCYCLE;SQLCREATE TABLE ord_items(or
23、d_no NUMBER(4)DEFAULT ord_seq.NEXTVAL NOT NULL,item_no NUMBER(3),qty NUMBER(3) CHECK (qty BETWEEN 100 AND 200),expiry_date date CHECK (expiry_date SYSDATE),CONSTRAINT it_pk PRIMARY KEY (ord_no,item_no),CONSTRAINT ord_fk FOREIGN KEY(ord_no) REFERENCES orders(ord_no);上述命令建立表失败,哪两个SQL语法失败?( AC )A.你在CHE
24、CK约束的条件下不能使用SYSDATE。B.你在CHECK约束条件下不能使用BETWEEN。C.你不能使用NEXTVAL序列值作为列的DEFAULT值。D.ORD_NO和ITEM_NO不能用于复合主键由于ORD_NO也是外键。27. 哪个CREATE TABLE语法是有效的?( D )A. CREATE TABLE ord_details(ord_no NUMBER(2) PRIMARY KEY,item_no NUMBER(3) PRIMARY KEY,ord_date DATE NOT NULL);B. CREATE TABLE ord_details(ord_no NUMBER(2) U
25、NIQUE, NOT NULL,item_no NUMBER(3),ord_date DATE DEFAULT SYSDATE NOT NULL);C. CREATE TABLE ord_details(ord_no NUMBER(2) ,item_no NUMBER(3),ord_date DATE DEFAULT NOT NULL,CONSTRAINT ord_uq UNIQUE (ord_no),CONSTRAINT ord_pk PRIMARY KEY (ord_no);D. CREATE TABLE ord_details(ord_no NUMBER(2),item_no NUMBE
26、R(3),ord_date DATE DEFAULT SYSDATE NOT NULL,CONSTRAINT ord_pk PRIMARY KEY (ord_no, item_no);28. 你用下列命令删除PRODUCTS表:SQLDROP TABLE products;下列哪三个说法对的的?( ABD )A.表的结构及所有数据都删除。B.在会话中未提交的事务被提交。C.表相应的所有的索引将保存但他们变为无效。D.所有的视图和同义词将保存但他们变为无效。E.所有的数据被删除但是表结构将保存。29. 检查下列CREATE SEQUENCE语法:CREATE SEQUENCE seq1START
27、 WITH 100INCREMENT BY 10MAXVALUE 200CYCLENOCACHE;当SEQ1序列生成到最大值为200。你执行下列SQL语法:SELECT seq1.nextval FROM dual;此SELECT语法显示什么?( A )A.1B.10C.100D. 出现错误30. 下面哪两个关于索引说法对的?( AD )A.他们可以建立在表和聚簇上。B.他们可以建立在表上和简朴视图上。C.你可以使用相同的列创建唯一索引。D.假如你指定相同列的不同组合可以建立多个索引。31. 检查下列SQL语法:用PRODUCTS表,你需要生成名字,当前价格列表,及打折扣25%后小于$10的所
28、有的这些产品。SQLSELECT prod_name, prod_list_price,prod_list_price - (prod_list_price * .25) DISCOUNTED_PRICEFROM productsWHERE discounted_price 10;此查询执行时发生一个错误。此错误的因素是什么?( C )A.括号应包含整个表达式。B.双引号应当从列别名被删除。C.在WHERE子句的表达式应被替换。D.列别名应为大写且在WHERE子句中用双引号括起来。32. 查看表PROMOTIONS表,PROMO_BEGIN_DATE是存储默认的日期,格式为dd-mon-rr.
29、你需要查看一个报表涉及表promos 所有的name,cost,start date。你能用哪个语法显示下列内容?( D )A. SELECT promo_name, promo_cost, promo_begin_dateFROM promotionsWHERE promo_category = post AND promo_begin_date 01-01-00;B. SELECT promo_name, promo_cost, promo_begin_dateFROM promotionsWHERE promo_cost LIKE post% AND promo_begin_date 0
30、1-01-2023;C. SELECT promo_name, promo_cost, promo_begin_dateFROM promotionsWHERE promo_category LIKE P% AND promo_begin_date 1-JANUARY-00;D. SELECT promo_name, promo_cost, promo_begin_dateFROM promotionsWHERE promo_category LIKE %post% AND promo_begin_date SELECT part_code FROM spares WHERE part_cod
31、e LIKE %_WQ12% ESCAPE ;哪个语句的输入是对的的?( D )A. 此语句错误.B. 此语句显示所有的值.C. 此语句只显示 A%_WQ123 and AB_WQ123 .D. 此语句只显示A%_WQ123 and A%BWQ123 .E. 此语句只显示A%BWQ123 and AB_WQ123.34. 查看PROMOTIONS表结构,你需要生成符合1.促销名不能以T或N开头。2.促销成本应大于$2023。3.促销结束时间大于2023年1月1日。哪个WHERE子句能得到对的的结果?( C )A. WHERE promo_name NOT LIKE T% OR promo_na
32、me NOT LIKE N% AND promo_cost 20230 AND promo_end_date 1-JAN-01B. WHERE (promo_name NOT LIKE T% AND promo_name NOT LIKE N%)OR promo_cost 20230 OR promo_end_date 1-JAN-01C. WHERE promo_name NOT LIKE T% AND promo_name NOT LIKE N% AND promo_cost 20230 AND promo_end_date 1-JAN-01D. WHERE (promo_name NOT
33、 LIKE %T% OR promo_name NOT LIKE %N%) AND(promo_cost 20230 AND promo_end_date 1-JAN-01)35. 查看表PROMOTIONS中的PROMO_CATEGORY 和 PROMO_COST字段,检查下列查询语句:SQLSELECT DISTINCT promo_category to_char(promo_cost)codeFROM promotionsORDER BY code;SQLSELECT DISTINCT promo_category promo_cost codeFROM promotionsORDER
34、 BY 1;上述SQL语句说法是对的的是?( B ) A. 只有第一个查询执行成功.B. 只有第二个查询执行成功.C. 两个查询执行成功但得到不同的结果。but give different results.D. 两个查询执行成功但得到相同的结果.36. 查看表CUSTOMERS,你需要生成一个报表显示客户的明细并按城市降序排序和收入水平由高到底排序。哪个查询能完毕这个任务?( A )A. SELECT cust_city, cust_income_level, cust_last_nameFROM customersORDER BY cust_city desc, cust_income_l
35、evel DESC ;B. SELECT cust_city, cust_income_level, cust_last_nameFROM customersORDER BY cust_income_level desc, cust_city DESC;C. SELECT cust_city, cust_income_level, cust_last_nameFROM customersORDER BY (cust_city, cust_income_level) DESC;D. SELECT cust_city, cust_income_level, cust_last_nameFROM c
36、ustomersORDER BY cust_city, cust_income_level DESC;37. 哪些任务能用SQL函数完毕?( ABC )选三项A.显示非默认格式的日期B.查找字符串的个数C.用指定的字符串替换表达式的字符串D.两个以上的列或表达式组合成在一个列并输出38. 在表PRODUCTS中有下列数据:PROD_ID PROD_LIST_PRICE-123456 152525.99你执行下列查询:SQL SELECT RPAD( ROUND(prod_list_price), 10,*)FROM productsWHERE prod_id = 123456;输出的结果对的的
37、是( A )?A. 152526 *B. *152525.99C. 152525* *D. an error message39. 在表CUSTOMER中你需要显示first name中涉及e字符且最后第二个字符是a的所有的客户。下列哪个能得到需要的结果?( A )A. SELECT cust_first_nameFROM customersWHERE INSTR(cust_first_name, e)0 ANDSUBSTR(cust_first_name, -2, 1)=a;B. SELECT cust_first_nameFROM customersWHERE INSTR(cust_fir
38、st_name, e) ANDSUBSTR(cust_first_name, -2, 1)=a;C. SELECT cust_first_nameFROM customersWHERE INSTR(cust_first_name, e)IS NOT NULL ANDSUBSTR(cust_first_name, 1,-2)=a;D. SELECT cust_first_nameFROM customersWHERE INSTR(cust_first_name, e)0 ANDSUBSTR(cust_first_name, LENGTH(cust_first_name),-2)=a;40. 检查
39、下列查询:SQL SELECT INITCAP(cust_first_name | | UPPER(SUBSTR(cust_city,-LENGTH(cust_city),2)FROM customersWHERE cust_first_name = ABIGAIL;哪个输出是对的的?( B )A. Abigail PAB. Abigail PaC. Abigail ISD. an error message41. 查看下列查询:SQL SELECT TRUNC(ROUND(156.00,-1),-1) FROM DUAL;哪个输出是对的的?( C )A. 16B. 100C. 160D. 2
40、00E. 15042. 查看表CUSTOMER的CUST_NAME字段的值:CUST_NAME-Renske LadwigJason MallinSamuel McCainAllan MCEwenIrene MikkilineniJulia Nayer你需要显示的客户,其中第二名称以“Mc”或“MC ”。哪个查询能得到对的的结果?( B )A. SELECT SUBSTR(cust_name, INSTR(cust_name, )+1)FROM customersWHERE INITCAP(SUBSTR(cust_name, INSTR(cust_name, )+1)=Mc;B. SELECT
41、 SUBSTR(cust_name, INSTR(cust_name, )+1)FROM customersWHERE INITCAP(SUBSTR(cust_name, INSTR(cust_name, )+1) LIKE Mc%;C. SELECT SUBSTR(cust_name, INSTR(cust_name, )+1) FROM customersWHERE SUBSTR(cust_name, INSTR(cust_name, )+1) LIKE INITCAP(MC%);D. SELECT SUBSTR(cust_name, INSTR(cust_name, )+1)FROM c
42、ustomersWHERE INITCAP(SUBSTR(cust_name, INSTR(cust_name, )+1) = INITCAP(MC%);43. 查看表CUST_TRANS的结构和数据:CUST_TRANS- Name Null TypeCUSTNO NOT NULL CHAR(2)TRANSDATE DATETRANSAMT NUMBER(6,2)CUSTNO TRANSDATE TRANSAMT-11 01-JAN-07 100022 01-FEB-07 202333 01-MAR-07 3000日期存储的默认格式为dd-mon-rr。哪个SQL语句能执行成功?( ACD
43、)选三项A. SELECT transdate + 10 FROM cust_trans;B. SELECT * FROM cust_trans WHERE transdate = 01-01-07;C. SELECT transamt FROM cust_trans WHERE custno 11;D. SELECT * FROM cust_trans WHERE transdate=01-JANUARY-07;E. SELECT custno + A FROM cust_trans WHERE transamt 2023;44. 你需要计算从2023年1月1日至今天的天数?日期的默认存储格
44、式为dd-mon-rr。下列哪两个SQL能得到对的的结果?( BC )选二项A. SELECT SYSDATE - 01-JAN-2023 FROM DUAL;B. SELECT SYSDATE - TO_DATE(01/JANUARY/2023) FROM DUAL;C. SELECT SYSDATE - TO_DATE(01-JANUARY-2023) FROM DUAL;D. SELECT TO_CHAR(SYSDATE, DD-MON-YYYY) - 01-JAN-2023 FROM DUAL;E. SELECT TO_DATE(SYSDATE, DD/MONTH/YYYY) - 01/JANUARY/2023 FROM DUAL;45