If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ANSI SQL > some questions

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 04-10-02, 11:01
robert123 robert123 is offline
Registered User
 
Join Date: Apr 2002
Posts: 6
some questions

Q1. The STUDENT_GRADES table has these columns:
STUDENT_ID NUMBER(12)SEMESTER_END DATEGPA NUMBER(4,3)
The registrar has requested a report listing the students' grade point averages (GPA), sorted from highest grade point average to lowest within each semester, starting from the earliest date. Which statement accomplishes this?

A.
SELECT student_id, semester_end, gpaFROM student_gradesORDER BY semester_end DESC, gpa DESC;

B.
SELECT student_id, semester_end, gpaFROM student_gradesORDER BY semester_end ASC, gpa ASC;

C.
SELECT student_id, semester_end, gpaFROM student_gradesORDER BY semester_end, gpa DESC;

D.
SELECT student_id, semester_end, gpaFROM student_gradesORDER BY gpa DESC, semester_end DESC;

E.
SELECT student_id, semester_end, gpaFROM student_gradesORDER BY gpa DESC, semester_end ASC;


Q2. You define a multiple-row subquery in the WHERE clause of an SQL query with a comparison operator "=".

What happens when the main query is executed?

A.
The main query executes with the first value returned by the subquery.
B.
The main query executes with the last value returned by the subquery.
C.
The main query executes with all the values returned by the subquery.
D.
The main query fails because the multiple-row subquery cannot be used with the comparison operator "=".
E.
You cannot define a multiple-row subquery in the WHERE clause of a SQL query.


Q3. Which SELECT statement should you use to extract the year from the system date and display it in the format "1998"?

A.
SELECT TO_CHAR(SYSDATE,'yyyy') FROM dual;

B.
SELECT TO_DATE(SYSDATE,'yyyy') FROM dual;

C.
SELECT DECODE(SUBSTR(SYSDATE, 8), 'YYYY') FROM dual;

D.
SELECT DECODE(SUBSTR(SYSDATE, 8), 'year') FROM dual;

E.
SELECT TO_CHAR(SUBSTR(SYSDATE, 8,2),'yyyy') FROM dual;

Q4. Evaluate this SQL statement:
SELECT e.employee_id, (.15* e.salary) + (.5 * e.commission_pct) + (s.sales_amount * (.35 * e.bonus)) AS CALC_VALUEFROM employees e, sales sWHERE e.employee_id = s.emp_id;
What will happen if you remove all the parentheses from the calculation?

A.
The value displayed in the CALC_VALUE column will be lower.
B.
The value displayed in the CALC_VALUE column will be higher.
C.
There will be no difference in the value displayed in the CALC_VALUE column.
D.
An error will be reported.
Reply With Quote
  #2 (permalink)  
Old 04-11-02, 09:03
alligatorsql.com alligatorsql.com is offline
Registered User
 
Join Date: Jul 2001
Location: Germany
Posts: 189
Dear Robert,

please create the tables and make your tests. That is what everybody has to do to find the correct answer - or somebody takes an hour of time to read your threads.

Regards
Manfred Peter
(Alligator Company)
http:/www.alligatorsql.com
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On