منتدى مدرسة عزيز المصرى الإعدادية للبنين
مرحباً بك فى منتدى مدرسة عزيز المصرى الاعدادية
إدارة بندر كفر الدوار التعليمية
منتدى مدرسة عزيز المصرى الإعدادية للبنين
مرحباً بك فى منتدى مدرسة عزيز المصرى الاعدادية
إدارة بندر كفر الدوار التعليمية
منتدى مدرسة عزيز المصرى الإعدادية للبنين
هل تريد التفاعل مع هذه المساهمة؟ كل ما عليك هو إنشاء حساب جديد ببضع خطوات أو تسجيل الدخول للمتابعة.

منتدى مدرسة عزيز المصرى الإعدادية للبنين



 
الرئيسيةالبوابةأحدث الصورالتسجيلدخول

 

 Mid Term Exam Semester 2 – Part I

اذهب الى الأسفل 
كاتب الموضوعرسالة
وفاء السيد الابيض




عدد الرسائل : 343
تاريخ التسجيل : 21/03/2009

Mid Term Exam Semester 2 – Part I Empty
مُساهمةموضوع: Mid Term Exam Semester 2 – Part I   Mid Term Exam Semester 2 – Part I I_icon_minitimeالأربعاء 30 مايو 2012, 14:39


Mid Term Exam Semester 2 – Part II »
Mid Term Exam Semester 2 – Part I
March 20, 2012 //
0
Test: Mid Term Exam Semester 2 – Part I

Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.
Part I of the Semester 2 Mid Term Exam covers Sections 1-4, and the Review of Joins in Section 5, of Database Programming with SQL curriculum.

Section 1

1.
You need to return a portion of each employee”s last name, beginning with the first character up to the fifth character. Which character function should you use? Mark for Review
(1) Points

INSTR

TRUNC

SUBSTR (*)

CONCAT

Correct

2.
You query the database with this SQL statement:
SELECT LOWER(SUBSTR(CONCAT(last_name, first_name)), 1, 5) “ID”
FROM employee;
In which order are the functions evaluated? Mark for Review
(1) Points

LOWER, SUBSTR, CONCAT

LOWER, CONCAT, SUBSTR

SUBSTR, CONCAT, LOWER

CONCAT, SUBSTR, LOWER (*)

Correct

3.
The STYLES table contains this data:
STYLE_ID STYLE_NAME CATEGORY COST
895840 SANDAL 85940 12.00
968950 SANDAL 85909 10.00
869506 SANDAL 89690 15.00
809090 LOAFER 89098 10.00
890890 LOAFER 89789 14.00
857689 HEEL 85940 11.00
758960 SANDAL 86979 12.00
You query the database and return the value 79. Which script did you use? Mark for Review
(1) Points

SELECT INSTR(category, 2,2)
FROM styles
WHERE style_id = 895840;

SELECT INSTR(category, -2,2)
FROM styles
WHERE style_id = 895840;

SELECT SUBSTR(category, 2,2)
FROM styles
WHERE style_id = 895840;

SELECT SUBSTR(category, -2,2)
FROM styles
WHERE style_id = 758960;
(*)

Incorrect. Refer to Section 1

4.
Which SQL function can be used to remove heading or trailing characters (or both) from a character string? Mark for Review
(1) Points

LPAD

CUT

NVL2

TRIM (*)

Correct

5.
You issue this SQL statement:
SELECT INSTR (‘organizational sales’, ‘al’)
FROM dual;
Which value is returned by this command? Mark for Review
(1) Points

1

2

13 (*)

17

Correct

6.
The PRICE table contains this data:
PRODUCT_ID MANUFACTURER_ID
86950 59604
You query the database and return the value 95. Which script did you use? Mark for Review
(1) Points

SELECT SUBSTR(product_id, 3, 2)
FROM price
WHERE manufacturer_id = 59604;
(*)

SELECT LENGTH(product_id, 3, 2)
FROM price
WHERE manufacturer_id = 59604;

SELECT SUBSTR(product_id, -1, 3)
FROM price
WHERE manufacturer_id = 59604;

SELECT TRIM(product_id, -3, 2)
FROM price
WHERE manufacturer_id = 59604;

Correct

7.
Evaluate this SELECT statement:
SELECT LENGTH(email)
FROM employee;
What will this SELECT statement display? Mark for Review
(1) Points

The longest e-mail address in the EMPLOYEE table

The email address of each employee in the EMPLOYEE table

The number of characters for each value in the EMAIL column in the employees table (*)

The maximum number of characters allowed in the EMAIL column

Correct

8.
You need to subtract three months from the current date. Which function should you use? Mark for Review
(1) Points

ROUND

TO_DATE

ADD_MONTHS (*)

MONTHS_BETWEEN

Correct

9.
Evaluate this SELECT statement:
SELECT SYSDATE + 30
FROM dual;
Which value is returned by the query? Mark for Review
(1) Points

The current date plus 30 hours.

The current date plus 30 days. (*)

The current date plus 30 months.

No value is returned because the SELECT statement generates an error.

Correct

10.
You need to display the current year as a character value (for example: Two Thousand and One). Which element would you use? Mark for Review
(1) Points

RR

YY

YYYY

YEAR (*)

Correct

Page 1 of 5

Section 1 11. Which SELECT statement will return a numeric value? Mark for Review
(1) Points

SELECT SYSDATE + 600 / 24
FROM employee;

SELECT ROUND(hire_date, DAY)
FROM employee;

SELECT (SYSDATE – hire_date) / 7
FROM employee;
(*)

SELECT SYSDATE – 7
FROM employee;

Incorrect. Refer to Section 1
12. Which function would you use to return the current database server date and time? Mark for Review
(1) Points

DATE

SYSDATE (*)

DATETIME

CURRENTDATE

Correct
13. You issue this SQL statement:
SELECT TRUNC(751.367,-1) FROM dual;
Which value does this statement display?
Mark for Review
(1) Points

700

750 (*)

751

751.3

Correct
14. Which comparison operator retrieves a list of values? Mark for Review
(1) Points

IN (*)

LIKE

BETWEEN … IN…

IS NULL

Correct
15. You issue this SQL statement:
SELECT ROUND (1282.248, -2) FROM dual;
What value does this statement produce?
Mark for Review
(1) Points

1200

1282

1282.25

1300 (*)

Correct
Section 2 16. The STYLES table contains this data:
STYLE_ID STYLE_NAME CATEGORY COST
895840 SANDAL 85940 12.00
968950 SANDAL 85909 10.00
869506 SANDAL 89690 15.00
809090 LOAFER 89098 10.00
890890 LOAFER 89789 14.00
857689 HEEL 85940 11.00
758960 SANDAL 86979
Evaluate this SELECT statement:
SELECT style_id, style_name, category, cost
FROM styles WHERE style_name LIKE ‘SANDAL’ AND NVL(cost, 0) < 15.00
ORDER BY category, cost;
Which result will the query provide?
Mark for Review
(1) Points

STYLE_ID STYLE_NAME CATEGORY COST
895840 SANDAL 85940 12.00
968950 SANDAL 85909 10.00
758960 SANDAL 86979

STYLE_ID STYLE_NAME CATEGORY COST
895840 SANDAL 85909 12.00
968950 SANDAL 85909 10.00
869506 SANDAL 89690 15.00
758960 SANDAL 86979

STYLE_ID STYLE_NAME CATEGORY COST
895840 SANDAL 85909 12.00
968950 SANDAL 85909 10.00
758960 SANDAL 86979
869506 SANDAL 89690 15.00

STYLE_ID STYLE_NAME CATEGORY COST
968950 SANDAL 85909 10.00
895840 SANDAL 85940 12.00
758960 SANDAL 86979
(*)

Correct
17. Which statement about group functions is true? Mark for Review
(1) Points

NVL and NVL2, but not COALESCE, can be used with group functions to replace null values.

NVL and COALESCE, but not NVL2, can be used with group functions to replace null values.

NVL, NVL2, and COALESCE can be used with group functions to replace null values. (*)

COALESCE, but not NVL and NVL2, can be used with group functions to replace null values.

Correct
18. When executed, which statement displays a zero if the TUITION_BALANCE value is zero and the HOUSING_BALANCE value is null? Mark for Review
(1) Points

SELECT NVL (tuition_balance + housing_balance, 0) “Balance Due”
FROM student_accounts;
(*)

SELECT NVL(tuition_balance, 0), NVL (housing_balance), tuition_balance + housing_balance “Balance Due”
FROM student_accounts;

SELECT tuition_balance + housing_balance
FROM student_accounts;

SELECT TO_NUMBER(tuition_balance, 0), TO_NUMBER (housing_balance, 0), tutition_balance + housing_balance “Balance Due”
FROM student_accounts;

Correct
19. The PRODUCT table contains this column: PRICE NUMBER(7,2)
Evaluate this statement:
SELECT NVL(10 / price, 4)
FROM PRODUCT;
What would happen if the PRICE column contains null values?
Mark for Review
(1) Points

The statement would fail because values cannot be divided by 4.

A value of 4 would be displayed. (*)

A value of 0 would be displayed.

The statement would fail because values cannot be divided by null.

Incorrect. Refer to Section 2
20. Which three statements concerning explicit data type conversions are true? (Choose three.) Mark for Review
(1) Points (Choose all correct answers)

Use the TO_NUMBER function to convert a number to a character string.

Use the TO_DATE function to convert a character string to a date value. (*)

Use the TO_NUMBER function to convert a character string of digits to a number. (*)

Use the TO_DATE function to convert a date value to character string or number.

Use the TO_CHAR function to convert a number or date value to character string. (*)

Use the TO_CHAR function to convert a character string to a number or date value.

Correct
Section 2 21. Which statement concerning single row functions is true? Mark for Review
(1) Points

Single row functions can accept only one argument, but can return multiple values.

Single row functions cannot modify a data type.

Single row functions can be nested. (*)

Single row functions return one or more results per row.

Correct
22. Which SQL Statement should you use to display the prices in this format: “$00.30″? Mark for Review
(1) Points

SELECT TO_CHAR(price, ‘$99,900.99′)
FROM product;
(*)

SELECT TO_CHAR(price, ‘$99,911.99′)
FROM product;

SELECT TO_CHAR(price, ‘$99,990.99′)
FROM product;

SELECT TO_NUMBER(price, ‘$99,900.99′)
FROM product;

Correct
23. The EMPLOYEES table contains these columns:
EMPLOYEE_ID NUMBER(9)
LAST_NAME VARCHAR2 (25)
FIRST_NAME VARCHAR2 (25)
SALARY NUMBER(6)
You need to create a report to display the salaries of all employees. Which script should you use to display the salaries in format: “$45,000.00″?
Mark for Review
(1) Points

SELECT TO_CHAR(salary, ‘$999,999′)
FROM employees;

SELECT TO_NUM(salary, ‘$999,990.99′)
FROM employees;

SELECT TO_NUM(salary, ‘$999,999.00′)
FROM employees;

SELECT TO_CHAR(salary, ‘$999,999.00′)
FROM employees;
(*)

Correct
24. All Human Resources data is stored in a table named EMPLOYEES. You have been asked to create a report that displays each employee’s name and salary. Each employee’s salary must be displayed in the following format: $000,000.00. Which function should you include in a SELECT statement to achieve the desired result? Mark for Review
(1) Points

TO_CHAR (*)

TO_DATE

TO_NUMBER

CHARTOROWID

Correct
25. Which two statements concerning SQL functions are true? (Choose two.) Mark for Review
(1) Points (Choose all correct answers)

Character functions can accept numeric input.

Not all date functions return date values. (*)

Number functions can return number or character values.

Conversion functions convert a value from one data type to another data type. (*)

Single-row functions manipulate groups of rows to return one result per group of rows.

Correct
Section 3 26. You need to provide a list of the first and last names of all employees who work in the Sales department who earned a bonus and had sales over $50,000. The company president would like the sales listed starting with the highest amount first. The EMPLOYEES table and the SALES_DEPT table contain the following columns:
EMPLOYEES
EMPLOYEE_ID NUMBER(10) PRIMARY KEY
LAST_NAME VARCHAR2(20)
FIRST_NAME VARCHAR2(20)
DEPARTMENT_ID VARCHAR2(20)
HIRE_DATE DATE
SALARY NUMBER(10)
SALES_DEPT
SALES_ID NUMBER(10) PRIMARY KEY
SALES NUMBER(20)
QUOTA NUMBER(20)
MANAGER VARCHAR2(30)
BONUS NUMBER(10)
EMPLOYEE_ID NUMBER(10) FOREIGN KEY
Which SELECT statement will accomplish this task?
Mark for Review
(1) Points

SELECT e.employee_id, e.last_name, e.first_name, s.employee_id, s.bonus, s.sales
FROM employees e, sales_dept s
ORDER BY sales DESC
WHERE e.employee_id = s.employee_id AND sales > 50000 AND s.bonus IS NOT NULL;

SELECT e.employee_id, e.last_name, e.first_name, s.employee_id, s.bonus, s. sales
ORDER BY sales DESC
FROM employees e, sales_dept s
WHERE e.employee_id = s.employee_id AND s.bonus IS NOT NULL AND sales > 50000;

SELECT e.employee_id, e.last_name, e.first_name, s.employee_id, s.bonus, s. sales
WHERE e.employee_id = s.employee_id
FROM employees e, sales_dept s AND s.bonus IS NOT NULL AND sales > 50000
ORDER BY sales DESC;

SELECT e.employee_id, e.last_name, e.first_name, s.employee_id, s.bonus, s. sales
FROM employees e, sales_dept s
WHERE e.employee_id = s.employee_id AND s.bonus IS NOT NULL AND sales > 50000
ORDER BY sales DESC;
(*)

Correct
27. You have the following EMPLOYEES table:
EMPLOYEE_ID NUMBER(5) NOT NULL PRIMARY KEY
FIRST_NAME VARCHAR2(25)
LAST_NAME VARCHAR2(25)
ADDRESS VARCHAR2(35)
CITY VARCHAR2(25)
STATE VARCHAR2(2)
ZIP NUMBER(9)
TELEPHONE NUMBER(10)
DEPARTMENT_ID NUMBER(5) NOT NULL FOREIGN KEY
The BONUS table includes the following columns:
BONUS_ID NUMBER(5) NOT NULL PRIMARY KEY
ANNUAL_SALARY NUMBER(10)
BONUS_PCT NUMBER(3, 2)
EMPLOYEE_ID VARCHAR2(5) NOT NULL FOREIGN KEY
You want to determine the amount of each employee’s bonus, as a calculation of salary times bonus. Which of the following queries should you issue?
Mark for Review
(1) Points

SELECT e.first_name, e.last_name, b.annual_salary * b. bonus_pct
FROM employees e, bonus b
WHERE e.employee_id = b.employee_id;
(*)

SELECT e.first_name, e.last_name, b.annual_salary, b. bonus_pct
FROM employees e, bonus b
WHERE e.employee_id = b.employee_id;

SELECT e.first_name, e.last_name, b.annual_salary, b. bonus_pct
FROM employees, bonus
WHERE e.employee_id = b.employee_id;

SELECT first_name, last_name, annual_salary * bonus_pct
FROM employees, bonus NATURAL JOIN;

Incorrect. Refer to Section 3
28. You need to create a report that lists all employees in department 10 (Sales) whose salary is not equal to $25,000 per year. Which query should you issue to accomplish this task? Mark for Review
(1) Points

SELECT last_name, first_name, salary
FROM employees
WHERE salary > 25000 AND department_id = 10;

SELECT last_name, first_name, salary
FROM employees
WHERE salary = 25000 AND department_id = 10;

SELECT last_name, first_name, salary
FROM employees
WHERE salary <= 25000 AND department_id = 10;

SELECT last_name, first_name, salary
FROM employees
WHERE salary != 25000 AND department_id = 10;
(*)

Correct
29. What is produced when a join condition is not specified in a multiple-table query using Oracle proprietary Join syntax? Mark for Review
(1) Points

A self-join

An outer join

An equijoin

A Cartesian product (*)

Correct
30. You have two tables named EMPLOYEES and SALES. You want to identify the sales representatives who have generated $100,000, or more, in revenue. Which query should you issue? Mark for Review
(1) Points

SELECT e.first_name, e.last_name, s.sales
FROM employees e, sales s
WHERE e.employee_id = s.employee_id AND revenue > 100000;

SELECT e.first_name, e.last_name, s.sales
FROM employees e, sales s
WHERE e.employee_id = s.employee_id AND revenue >= 100000;
(*)

SELECT e.first_name, e.last_name, s.sales
FROM employees, sales
WHERE e.employee_id = s.employee_id AND revenue >= 100000;

SELECT first_name, last_name, sales
FROM employees e, sales s
WHERE e.employee_id = s.employee_id AND revenue > 100000;

Correct
Section 3 31. Which statement about the join syntax of an Oracle Proprietary join syntax SELECT statement is true? Mark for Review
(1) Points

The ON keyword must be included.

The JOIN keyword must be included.

The FROM clause represents the join criteria.

The WHERE clause represents the join criteria. (*)

Correct
32. You need to join the EMPLOYEES table and the SCHEDULES table, but the two tables do not have any corresponding columns. Which type of join will you create? Mark for Review
(1) Points

An equijoin

A cross join

A non-equijoin (*)

A full outer join

Incorrect. Refer to Section 3
33. Evaluate this SELECT statement:
SELECT p.player_id, m.last_name, m.first_name, t.team_name
FROM player p
LEFT OUTER JOIN player m ON (p.manager_id = m.player_id)
LEFT OUTER JOIN team t ON (p.team_id = t.team_id);
Which join is evaluated first?
Mark for Review
(1) Points

The self-join of the player table (*)

The join between the player table and the team table on TEAM_ID

The join between the player table and the team table on MANAGER_ID

The join between the player table and the team table on PLAYER_ID

Correct
34. The EMPLOYEE_ID column in the EMPLOYEES table corresponds to the EMPLOYEE_ID column of the ORDERS table. The EMPLOYEE_ID column in the ORDERS table contains null values for rows that you need to display.
Which type of join should you use to display the data? Mark for Review
(1) Points

Natural join

Self-join

Outer join (*)

Equijoin

Correct
35. Using Oracle Proprietary join syntax, which two operators can be used in an outer join condition using the outer join operator (+)? Mark for Review
(1) Points

AND and = (*)

OR and =

BETWEEN…AND… and IN

IN and =

Correct
36. Evaluate this SELECT statement:
SELECT *
FROM employee e, employee m
WHERE e.manager_id = m.employee_id;
Which type of join is created by this SELECT statement?
Mark for Review
(1) Points

a self join (*)

a cross join

a left outer join

a full outer join

Incorrect. Refer to Section 3
Section 4 37. You need to join the EMPLOYEE_HIST and EMPLOYEES tables. The EMPLOYEE_HIST table will be the first table in the FROM clause. All the matched and unmatched rows in the EMPLOYEES table need to be displayed. Which type of join will you use? Mark for Review
(1) Points

A cross join

An inner join

A left outer join

A right outer join (*)

Incorrect. Refer to Section 4
38. Which query represents the correct syntax for a left outer join? Mark for Review
(1) Points

SELECT companyname, orderdate, total
FROM customers c
LEFT JOIN orders o
ON c.cust_id = o.cust_id;

SELECT companyname, orderdate, total
FROM customers c
OUTER JOIN orders o
ON c.cust_id = o.cust_id;

SELECT companyname, orderdate, total
FROM customers c
LEFT OUTER JOIN orders o
ON c.cust_id = o.cust_id;
(*)

SELECT companyname, orderdate, total
FROM customers c
LEFT OUTER orders o
ON c.cust_id = o.cust_id;

Correct
39. Which query will retrieve all the rows in the EMPLOYEES table, even if there is no match in the DEPARTMENTS table? Mark for Review
(1) Points

SELECT e.last_name, e.department_id, d.department_name
FROM employees e
RIGHT OUTER JOIN departments d ON (e.department_id = d.department_id);

SELECT e.last_name, e.department_id, d.department_name
FROM employees e
NATURAL JOIN departments d;
NATURAL JOIN departments d;

SELECT e.last_name, e.department_id, d.department_name
FROM employees e
LEFT OUTER JOIN departments d ON (e.department_id = d.department_id);
(*)

SELECT e.last_name, e.department_id, d.department_name
FROM employees e
JOIN departments d USING (e.department_id = d.department_id);

Correct
40. Which of the following best describes a natural join? Mark for Review
(1) Points

A join between two tables that includes columns that share the same name, datatypes and lengths (*)

A join that produces a Cartesian product

A join between tables where matching fields do not exist

A join that uses only one table

Correct
Section 4 41. Which statement about a natural join is true? Mark for Review
(1) Points

Columns with the same names must have identical data types.

Columns with the same names must have the same precision and datatype. (*)

Columns with the same names must have compatible data types.

Columns with the same names cannot be included in the SELECT list of the query.

Correct
42. You need to join two tables that have two columns with the same name, datatype and precision. Which type of join would you create to join the tables on both of the columns? Mark for Review
(1) Points

Natural join (*)

Cross join

Outer join

Self-join

Correct
43. The primary advantages of using JOIN ON is: (Select two) Mark for Review
(1) Points (Choose all correct answers)

The join happens automatically based on matching column names and data types.

It will display rows that do not meet the join condition.

It permits columns with different names to be joined. (*)

It permits columns that don’t have matching data types to be joined. (*)

Correct
44. For which condition would you use an equijoin query with the USING keyword? Mark for Review
(1) Points

You need to perform a join of the CUSTOMER and ORDER tables but limit the number of columns in the join condition. (*)

The ORDER table contains a column that has a referential constraint to a column in the PRODUCT table.

The CUSTOMER and ORDER tables have no columns with identical names.

The CUSTOMER and ORDER tables have a corresponding column, CUST_ID. The CUST_ID column in the ORDER table contains null values that need to be displayed.

Incorrect. Refer to Section 4
45. You created the CUSTOMERS and ORDERS tables by issuing these CREATE TABLE statements in sequence:
CREATE TABLE customers
(custid varchar2(5),
companyname varchar2(30),
contactname varchar2(30),
address varchar2(30),
city varchar2(20),
state varchar2(30),
phone varchar2(20),
constraint pk_customers_01 primary key (custid));
CREATE TABLE orders
(orderid varchar2(5) constraint pk_orders_01 primary key,
orderdate date,
total number(15),
custid varchar2(5) references customers (custid));
You have been instructed to compile a report to present the information about orders placed by customers who reside in Nashville. Which query should you issue to achieve the desired results?
Mark for Review
(1) Points

SELECT custid, companyname
FROM customers
WHERE city = ‘Nashville’;

SELECT orderid, orderdate, total
FROM orders o
NATURAL JOIN customers c ON o.custid = c.custid
WHERE city = ‘Nashville’;

SELECT orderid, orderdate, total
FROM orders o
JOIN customers c ON o.custid = c.custid
WHERE city = ‘Nashville’;
(*)

SELECT orderid, orderdate, total
FROM orders
WHERE city = ‘Nashville’;

Correct
46. Below find the structure of the CUSTOMERS and SALES_ORDER tables:
CUSTOMERS
CUSTOMER_ID NUMBER NOT NULL, Primary Key
CUSTOMER_NAME VARCHAR2 (30)
CONTACT_NAME VARCHAR2 (30)
CONTACT_TITLE VARCHAR2 (20)
ADDRESS VARCHAR2 (30)
CITY VARCHAR2 (25)
REGION VARCHAR2 (10)
POSTAL_CODE VARCHAR2 (20)
COUNTRY_ID NUMBER Foreign key to COUNTRY_ID column of the COUNTRY table
PHONE VARCHAR2 (20)
FAX VARCHAR2 (20)
CREDIT_LIMIT NUMBER(7,2)
SALES_ORDER
ORDER_ID NUMBER NOT NULL, Primary Key
CUSTOMER_ID NUMBER Foreign key to CUSTOMER_ID column of the CUSTOMER table
ORDER_DT DATE
ORDER_AMT NUMBER (7,2)
SHIP_METHOD VARCHAR2 (5)
You need to create a report that displays customers without a sales order. Which statement could you use?
Mark for Review
(1) Points

SELECT c.customer_name
FROM customers c
WHERE c.customer_id not in (SELECT s.customer_id FROM sales_order s);
(*)

SELECT c.customer_name
FROM customers c, sales_order s
WHERE c.customer_id = s.customer_id(+);

SELECT c.customer_name
FROM customers c, sales_order s
WHERE c.customer_id (+) = s.customer_id;

SELECT c.customer_name
FROM customers c
RIGHT OUTER JOIN sales_order s
ON (c.customer_id = s.customer_id);

Correct
Section 5 47. Which statement about the GROUP BY clause is true? Mark for Review
(1) Points

The first column listed in the GROUP BY clause is the most major grouping. (*)

The last column listed in the GROUP BY clause is the most major grouping.

The GROUP BY clause can contain an aggregate function.

A GROUP BY clause cannot be used without an ORDER BY clause.

Correct
48. If a select list contains both a column as well as a group function then what clause is required? Mark for Review
(1) Points

HAVING clause

JOIN clause

ORDER BY clause

GROUP BY clause (*)

Correct
49. What is the best explanation as to why this SQL statement will NOT execute?
SELECT department_id “Department”, AVG (salary)”Average”
FROM employees
GROUP BY Department;
Mark for Review
(1) Points

Salaries cannot be averaged as not all the numbers will divide evenly.

You cannot use a column alias in the GROUP BY clause. (*)

The GROUP BY clause must have something to GROUP.

The department id is not listed in the departments table.

Correct
50. What will the following SQL Statement do?
SELECT job_id, COUNT(*)
FROM employees
GROUP BY job_id;
Mark for Review
(1) Points

Displays all the employees and groups them by job.

Displays each job id and the number of people assigned to that job id. (*)

Displays only the number of job_ids.

Displays all the jobs with as many people as there are jobs.

Correct
الرجوع الى أعلى الصفحة اذهب الى الأسفل
 
Mid Term Exam Semester 2 – Part I
الرجوع الى أعلى الصفحة 
صفحة 1 من اصل 1
 مواضيع مماثلة
-
» Test: Mid Term Exam Semester 2 - Part II
» Test: Mid-Term Exam Semester 2 Part Two
» Test: Mid-Term Exam Semester 2 Part Two
»  Test: Final Exam Semester 2 - Part Iexm part 2-1
» Test: Final Exam Semester 2 - Part I

صلاحيات هذا المنتدى:لاتستطيع الرد على المواضيع في هذا المنتدى
منتدى مدرسة عزيز المصرى الإعدادية للبنين :: منتديات المدرسة :: الحاسب الآلى-
انتقل الى: