All Questions

Beschreibung

Correction question of my Oracle assessment
Patrick Lafferty
Quiz von Patrick Lafferty, aktualisiert more than 1 year ago
Patrick Lafferty
Erstellt von Patrick Lafferty vor etwa 8 Jahre
542
0

Zusammenfassung der Ressource

Frage 1

Frage
CUBE will cross-reference the columns listed in the ______ clause to create a superset of groups.
Antworten
  • GROUP BY
  • WHERE
  • SELECT

Frage 2

Frage
You use GROUPING functions to:
Antworten
  • Produce subtotal and cross-tabulated values
  • Identify the extra row values created by either a ROLLUP or CUBE operation
  • Aggregate rows using SUM, MIN, MAX, and COUNT

Frage 3

Frage
CUBE can be applied to all aggregate functions including AVG, SUM, MIN, MAX, and COUNT. True or False?
Antworten
  • True
  • False

Frage 4

Frage
GROUPING SETS is another extension to the GROUP BY clause and is used to specify multiple groupings of data but provide a single result set. True or False?
Antworten
  • True
  • False

Frage 5

Frage
When using SET operators, the names of the matching columns must be identical in all of the SELECT statements used in the query. True or False?
Antworten
  • True
  • False

Frage 6

Frage
When using SET operators, the number of columns and the data types of the columns must be identical in all of the SELECT statements used in the query. True or False.
Antworten
  • True
  • False

Frage 7

Frage
The EMPLOYEES table contains these columns: ID_NUMBER NUMBER Primary Key NAME VARCHAR2 (30) DEPARTMENT_ID NUMBER SALARY NUMBER (7,2) HIRE_DATE DATE Evaluate this SQL statement: SELECT id_number, name, department_id, SUM(salary) FROM employees WHERE salary > 25000 GROUP BY department_id, id_number, name ORDER BY hire_date; Why will this statement cause an error?
Antworten
  • The HAVING clause is missing.
  • The WHERE clause contains a syntax error.
  • The SALARY column is NOT included in the GROUP BY clause.
  • The HIRE_DATE column is NOT included in the GROUP BY clause

Frage 8

Frage
Evaluate this SELECT statement: SELECT SUM(salary), department_id, manager_id FROM employees GROUP BY department_id, manager_id; Which SELECT clause allows you to restrict the rows returned, based on a group function?
Antworten
  • HAVING SUM(salary) > 100000
  • WHERE SUM(salary) > 100000
  • WHERE salary > 100000
  • HAVING salary > 100000

Frage 9

Frage
The PRODUCTS table contains these columns: PRODUCT_ID NUMBER(9) PK CATEGORY_ID VARCHAR2(10) LOCATION_ID NUMBER(9) DESCRIPTION VARCHAR2(30) COST NUMBER(7,2) PRICE NUMBER(7,2) QUANTITY NUMBER You display the total of the extended costs for each product category by location. You need to include only the products that have a price less than $25.00. The extended cost of each item equals the quantity value multiplied by the cost value. Which SQL statement will display the desired result?
Antworten
  • SELECT category_id, SUM(cost * quantity) TOTAL,location_id FROM products WHERE price > 25.00 GROUP BY category_id, location_id;
  • SELECT SUM(cost * quantity) TOTAL, location_id FROM products WHERE price < 25.00 GROUP BY location_id;
  • SELECT category_id, SUM(cost * quantity) TOTAL, location_id FROM products WHERE price < 25.00 GROUP BY category_id, location_id;
  • SELECT SUM(cost * quantity) TOTAL FROM products WHERE price < 25.00

Frage 10

Frage
The PLAYERS and TEAMS tables contain these columns: PLAYERS PLAYER_ID NUMBER NOT NULL, PRIMARY KEY LAST_NAME VARCHAR2 (30) NOT NULL FIRST_NAME VARCHAR2 (25) NOT NULL TEAM_ID NUMBER POSITION VARCHAR2 (25) TEAMS TEAM_ID NUMBER NOT NULL, PRIMARY KEY TEAM_NAME VARCHAR2 (25) You need to create a report that lists the names of each team with more than three goal keepers. Which SELECT statement will produce the desired result?
Antworten
  • SELECT t.team_name, COUNT(p.player_id) FROM players p, teams t ON (p.team_id = t.team_id) WHERE UPPER(p.position) = 'GOAL KEEPER' GROUP BY t.team_name;
  • SELECT t.team_name, COUNT(p.player_id) FROM players JOIN teams t ON (p.team_id = t.team_id) WHERE UPPER(p.position) = 'GOAL KEEPER' HAVING COUNT(p.player_id) > 3;
  • SELECT t.team_name, COUNT(p.player_id) FROM players p, teams t ON (p.team_id = t.team_id) WHERE UPPER(p.position) = 'GOAL KEEPER' GROUP BY t.team_name HAVING COUNT(p.player_id) > 3;
  • SELECT t.team_name, COUNT(p.player_id) FROM players p JOIN teams t ON (p.team_id = t.team_id) WHERE UPPER(p.position) = 'GOAL KEEPER' GROUP BY t.team_name HAVING COUNT(p.player_id) > 3;

Frage 11

Frage
If a select list contains both a column as well as a group function then what clause is required?
Antworten
  • HAVING clause
  • JOIN clause
  • ORDER BY clause
  • GROUP BY clause

Frage 12

Frage
The PRODUCTS table contains these columns: PROD_ID NUMBER(4) PROD_NAME VARCHAR(20) PROD_CAT VARCHAR2(15) PROD_PRICE NUMBER(5) PROD_QTY NUMBER(4) You need to identify the minimum product price in each product category. Which statement could you use to accomplish this task?
Antworten
  • SELECT prod_cat, MIN (prod_price) FROM products GROUP BY prod_price;
  • SELECT prod_cat, MIN (prod_price) FROM products GROUP BY prod_cat;
  • SELECT MIN (prod_price), prod_cat FROM products GROUP BY MIN (prod_price), prod_cat;
  • SELECT prod_price, MIN (prod_cat) FROM products GROUP BY prod_cat;

Frage 13

Frage
Group functions can be nested to a depth of?
Antworten
  • Three
  • Four
  • Two
  • Group functions cannot be nested

Frage 14

Frage
What will the following SQL Statement do? SELECT job_id, COUNT(*) FROM employees GROUP BY job_id;
Antworten
  • 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

Frage 15

Frage
The EMPLOYEES table contains the following columns: EMPLOYEE_ID NUMBER(10) PRIMARY KEY LAST_NAME VARCHAR2(20) FIRST_NAME VARCHAR2(20) DEPARTMENT VARCHAR2(20) HIRE_DATE DATE SALARY NUMBER(10) You want to create a report that includes each employee's last name, employee identification number, date of hire, and salary. The report should include only those employees who have been with the company for more than one year and whose salary exceeds $40,000. Which of the following SELECT statements will accomplish this task?
Antworten
  • SELECT employee_id, last_name, salary FROM employees WHERE salary > 40000 AND hire_date = (SELECT hire_date FROM employees WHERE (sysdate-hire_date) / 365 > 1);
  • SELECT employee_id, last_name, hire_date, salary FROM employees WHERE salary > 40000 AND hire_date = (SELECT hire_date FROM employees WHERE (sysdate-hire_date) / 365 > 1);
  • SELECT employee_id, last_name, hire_date, salary FROM employees WHERE salary > 40000 AND (sysdate-hire_date) / 365 > 1;
  • SELECT employee_id, last_name, salary FROM employees WHERE salary > 40000 AND hire_date IN (sysdate-hire_date) / 365 > 1);

Frage 16

Frage
Which statement about group functions is true?
Antworten
  • Group functions ignore null values.
  • Group functions can only be used in a SELECT list.
  • Group functions can be used in a WHERE clause.
  • A query that includes a group function in the SELECT list must include a GROUP BY clause.

Frage 17

Frage
You want to write a report that returns the average salary of all employees in the company, sorted by departments. The EMPLOYEES table contains the following columns: EMPLOYEES: EMP_ID NUMBER(10) PRIMARY KEY LNAME VARCHAR2(20) FNAME VARCHAR2(20) DEPT VARCHAR2(20) HIRE_DATE DATE SALARY NUMBER(10) Which SELECT statement will return the information that you require?
Antworten
  • SELECT salary(AVG), dept FROM employees GROUP BY dept;
  • SELECT dept, AVG(salary) FROM employees GROUP BY dept;
  • SELECT AVG (salary) FROM employees BY dept;
  • SELECT AVG salary FROM employees BY dept;

Frage 18

Frage
Evaluate this SELECT statement: SELECT COUNT(employee_id), department_id FROM employees GROUP BY department_id; You only want to include employees who earn more than 15000. Which clause should you include in the SELECT statement?
Antworten
  • WHERE salary > 15000
  • HAVING salary > 15000
  • WHERE SUM(salary) > 15000
  • HAVING SUM(salary) > 15000

Frage 19

Frage
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;
Antworten
  • 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.

Frage 20

Frage
Which comparison operator can only be used with a single-row subquery?
Antworten
  • ANY
  • ALL
  • < >
  • IN

Frage 21

Frage
Which statement about the <> operator is true?
Antworten
  • The <> operator is NOT a valid SQL operator.
  • The <> operator CANNOT be used in a single-row subquery.
  • The <> operator returns the same result as the ANY operator in a subquery.
  • The <> operator can be used when a single-row subquery returns only one row.

Frage 22

Frage
The EMPLOYEES and ORDERS tables contain these columns: EMPLOYEES EMPLOYEE_ID NUMBER(10) NOT NULL PRIMARY KEY FIRST_NAME VARCHAR2(30) LAST_NAME VARCHAR2(30) ADDRESS VARCHAR2(25) CITY VARCHAR2(20) STATE VARCHAR2(2) ZIP NUMBER(9) TELEPHONE NUMBER(10) ORDERS ORDER_ID NUMBER(10) NOT NULL PRIMARY KEY EMPLOYEE_ID NUMBER(10) NOT NULL FOREIGN KEY ORDER_DATE DATE TOTAL NUMBER(10) Which SELECT statement will return all orders generated by a sales representative named Franklin during the year 2001?
Antworten
  • SELECT order_id, total FROM ORDERS (SELECT employee_id FROM employees WHERE last_name = 'Franklin') WHERE order_date BETWEEN '01-jan-2001' AND '31-dec-2001';
  • SELECT (SELECT employee_id FROM employees WHERE last_name = 'Franklin') AND order_id, total FROM ORDERS WHERE order_date BETWEEN '01-jan-2001' AND '31-dec-2001';
  • SELECT order_id, employee_id, total FROM ORDERS WHERE order_date BETWEEN '01-jan-2001' AND '31-dec-2001' AND emp_id = 'Franklin';
  • SELECT order_id, total FROM ORDERS WHERE employee_id = (SELECT employee_id FROM employees WHERE last_name = 'Franklin') AND order_date BETWEEN '01-jan-2001' AND '31-dec-2001';

Frage 23

Frage
Which of the following is TRUE regarding the order of subquery execution?
Antworten
  • The outer query is executed first.
  • The subquery executes once after the main query.
  • The subquery executes once before the main query.
  • The result of the main query is used with the subquery.

Frage 24

Frage
The TEACHERS and CLASS_ASSIGNMENTS tables contain these columns: TEACHERS TEACHER_ID NUMBER(5) Primary Key NAME VARCHAR2 (25) SUBJECT_ID NUMBER(5) CLASS_ID NUMBER(5) CLASS_ASSIGNMENTS CLASS_ID NUMBER (5) Primary Key TEACHER_ID NUMBER (5) DATE MAX_CAPACITY NUMBER (3) All MAX_CAPACITY values are greater than 10. Which two SQL statements correctly use subqueries? (Choose two.) (Choose all correct answers)
Antworten
  • SELECT * FROM class_assignments WHERE max_capacity = (SELECT AVG(max_capacity) FROM class_assignments);
  • SELECT * FROM teachers WHERE teacher_id = (SELECT teacher_id FROM class_assignments WHERE class_id = 45963);
  • SELECT * FROM teachers WHERE teacher_id = (SELECT teacher_id, class_assignments WHERE max_capacity > 0);
  • SELECT * FROM teachers WHERE teacher_id LIKE (SELECT teacher_id FROM class_assignments WHERE max_capacity > 1000);
  • SELECT * FROM class_assignments max_capacity = (SELECT AVG(max_capacity) FROM class_assignments GROUP BY teacher_id);

Frage 25

Frage
You need to create a report to display the names of products with a cost value greater than the average cost of all products. Which SELECT statement should you use?
Antworten
  • SELECT product_name FROM products WHERE cost > (SELECT AVG(cost) FROM products);
  • SELECT product_name FROM products WHERE cost > AVG(cost);
  • SELECT AVG(cost), product_name FROM products WHERE cost > AVG(cost) GROUP by product_name;
  • SELECT product_name FROM (SELECT AVG(cost) FROM product) WHERE cost > AVG(cost);

Frage 26

Frage
You need to display all the players whose salaries are greater than or equal to John Brown's salary. Which comparison operator should you use?
Antworten
  • =
  • >
  • <=
  • >=

Frage 27

Frage
Using a subquery in which clause will return a syntax error?
Antworten
  • WHERE
  • FROM
  • HAVING
  • You can use subqueries in all of the above clauses.

Frage 28

Frage
Which statement about subqueries is true?
Antworten
  • Subqueries should be enclosed in double quotation marks.
  • Subqueries cannot contain group functions.
  • Subqueries are often used in a WHERE clause to return values for an unknown conditional value.
  • Subqueries generally execute last, after the main or outer query executes.

Frage 29

Frage
If you use the equality operator (=) with a subquery, how many values can the subquery return?
Antworten
  • ONLY 1
  • Up to 2
  • Up to 5
  • Unlimited

Frage 30

Frage
Which statement is false?
Antworten
  • The WITH clause retrieves the results of one or more query blocks.
  • The WITH clause decreases performance.
  • The WITH clause makes the query simple to read.
  • The WITH clause stores the results for the user who runs the query.

Frage 31

Frage
Which answer is INCORRECT? The parent statement of a correlated subquery can be:
Antworten
  • A SELECT statement
  • An INSERT statement
  • An UPDATE statement
  • A DELETE statement

Frage 32

Frage
The Oracle server performs a correlated subquery when the subquery references a column from a table referred to in the parent. True or False?
Antworten
  • True
  • False

Frage 33

Frage
The WITH clause enables a SELECT statement to define the subquery block at the start of the query, process the block just once, label the results, and then refer to the results multiple times. True or False?
Antworten
  • True
  • False

Frage 34

Frage
You need to create a SELECT statement that contains a multiple-row subquery. Which comparison operator(s) can you use?
Antworten
  • IN, ANY, and ALL
  • LIKE
  • BETWEEN ... AND ...
  • =, <, and >

Frage 35

Frage
Examine the data in the PAYMENT table: This statement fails when executed: FROM payment WHERE payment_id = (SELECT payment_id FROM payment WHERE payment_date >= '05-JAN-2002' OR payment_amount > 500.00); Which change could correct the problem?
Antworten
  • Remove the subquery WHERE clause.
  • Change the outer query WHERE clause to 'WHERE payment_id IN'.
  • Include the PAYMENT_ID column in the select list of the outer query.
  • Remove the single quotes around the date value in the inner query WHERE clause.

Frage 36

Frage
Evaluate this SELECT statement: SELECT player_id, name FROM players WHERE team_id IN (SELECT team_id FROM teams WHERE team_id > 300 AND salary_cap > 400000); What would happen if the inner query returned a NULL value?
Antworten
  • No rows would be returned by the outer query.
  • A syntax error in the outer query would be returned.
  • A syntax error in the inner query would be returned.
  • All the rows in the PLAYER table would be returned by the outer query.

Frage 37

Frage
Assume all the column names are correct. The following SQL statement will execute which of the following? INSERT INTO departments (department_id, department_name, manager_id, location_id) VALUES (70, 'Public Relations', 100, 1700);
Antworten
  • 100 will be inserted into the department_id column.
  • 1700 will be inserted into the manager_id column.
  • 70 will be inserted into the department_id column.
  • "Public Relations" will be inserted into the manager_name column.

Frage 38

Frage
The PRODUCTS table contains these columns: PRODUCT_ID NUMBER NOT NULL PRODUCT_NAME VARCHAR2 (25) SUPPLIER_ID NUMBER NOT NULL LIST_PRICE NUMBER (7,2) COST NUMBER (5,2) QTY_IN_STOCK NUMBER(4) LAST_ORDER_DT DATE DEFAULT SYSDATE NOT NUL Which INSERT statement will execute successfully?
Antworten
  • INSERT INTO products (product_id, product_name, supplier_id, list_price, cost, qty_in_stock) VALUES(2958, 'Cable', 8690, 7.09, 4.04, 700)
  • INSERT INTO products VALUES (2958, 'Cable', 8690, 7.09, 4.04, SYSDATE);
  • INSERT INTO products(product_id, product_name) VALUES (2958, 'Cable');
  • INSERT INTO products(product_id, product_name, supplier_id VALUES (2958, 'Cable', 8690, SYSDATE);

Frage 39

Frage
The STUDENTS table contains these columns: STU_ID NUMBER(9) NOT NULL LAST_NAME VARCHAR2 (30) NOT NULL FIRST_NAME VARCHAR2 (25) NOT NULL DOB DATE STU_TYPE_ID VARCHAR2(1) NOT NULL ENROLL_DATE DATE You create another table, named FT_STUDENTS, with an identical structure.You want to insert all full-time students who have a STU_TYPE_ID value of "F" into the new table. You execute this INSERT statement: INSERT INTO ft_students (SELECT stu_id, last_name, first_name, dob, stu_type_id, enroll_date FROM students WHERE UPPER(stu_type_id) = 'F'); What is the result of executing this INSERT statement?
Antworten
  • All full-time students are inserted into the FT_STUDENTS table.
  • An error occurs because the FT_STUDENTS table already exists.
  • An error occurs because you CANNOT use a subquery in an INSERT statement.
  • An error occurs because the INSERT statement does NOT contain a VALUES clause.

Frage 40

Frage
You have been instructed to add a new customer to the CUSTOMERS table. Because the new customer has not had a credit check, you should not add an amount to the CREDIT column. The CUSTOMERS table contains these columns: CUST_ID NUMBER(10) COMPANY VARCHAR2(30) CREDIT NUMBER(10) POC VARCHAR2(30) LOCATION VARCHAR2(30) Which two INSERT statements will accomplish your objective? (Choose all correct answers)
Antworten
  • INSERT INTO customers (cust_id, company, poc, location) VALUES (200, 'InterCargo', 'tflanders', 'samerica');
  • INSERT INTO customers VALUES (200, 'InterCargo', null, 'tflanders', 'samerica');
  • INSERT INTO customers VALUES (cust_id, company, credit, poc, location) (200, 'InterCargo', 0, 'tflanders', 'samerica');
  • INSERT INTO customers VALUES (200, InterCargo, 0, tflanders, samerica);

Frage 41

Frage
Which two commands can be used to modify existing data in a database row? (Choose all correct answers)
Antworten
  • DELETE
  • MERGE
  • SELECT
  • UPDATE

Frage 42

Frage
You need to delete a record in the EMPLOYEES table for Tim Jones, whose unique employee identification number is 348. The EMPLOYEES table contains these columns: EMPLOYEE_ID NUMBER(5) PRIMARY KEY LAST_NAME VARCHAR2(20) FIRST_NAME VARCHAR2(20) ADDRESS VARCHAR2(30) PHONE NUMBER(10) Which DELETE statement will delete the appropriate record without deleting any additional records?
Antworten
  • DELETE FROM employees WHERE employee_id = 348;
  • DELETE FROM employees WHERE last_name = jones;
  • DELETE * FROM employees WHERE employee_id = 348;
  • DELETE 'jones' FROM employees;

Frage 43

Frage
Which of the following represents the correct syntax for an INSERT statement?
Antworten
  • INSERT VALUES INTO customers (3178 J. Smith 123 Main Street Nashville TN 37777;
  • INSERT INTO customers VALUES '3178' 'J.' 'Smith' '123 Main Street' 'Nashville' 'TN' '37777';
  • INSERT INTO customers VALUES ('3178', 'J.', 'Smith', '123 Main Street', 'Nashville', 'TN', '37777');
  • INSERT customers VALUES 3178, J., Smith, 123 Main Street, Nashville, TN, 37777;

Frage 44

Frage
What keyword in an UPDATE statement specifies the column that you want to change?
Antworten
  • SELECT
  • WHERE
  • SET
  • HAVING

Frage 45

Frage
You need to update both the DEPARTMENT_ID and LOCATION_ID columns in the EMPLOYEES table using one UPDATE statement. Which clause should you include in the UPDATE statement to update multiple columns?
Antworten
  • The USING clause
  • The ON clause
  • The WHERE clause
  • The SET clause

Frage 46

Frage
The EMPLOYEES table contains the following columns: EMPLOYEE_ID NUMBER(10) PRIMARY KEY LAST_NAME VARCHAR2(20) FAST_NAME VARCHAR2(20) DEPARTMENT_ID VARCHAR2(20) HIRE_DATE DATE SALARY NUMBER(9,2) BONUS NUMBER(9,2) You want to execute one DML statement to change the salary of all employees in department 10 to equal the new salary of employee number 89898. Currently, all employees in department 10 have the same salary value. Which statement should you execute?
Antworten
  • UPDATE employees SET salary = SELECT salary FROM employees WHERE employee_id = 89898;
  • UPDATE employees SET salary = (SELECT salary FROM employees WHERE employee_id = 89898);
  • UPDATE employees SET salary = (SELECT salary FROM employees WHERE employee_id = 89898) WHERE department_id = 10;
  • UPDATE employees SET salary = (SELECT salary FROM employees WHERE employee_id = 89898 AND department_id = 10);

Frage 47

Frage
When the WHERE clause is missing in a DELETE statement, what is the result?
Antworten
  • All rows are deleted from the table.
  • The table is removed from the database.
  • An error message is displayed indicating incorrect syntax.
  • Nothing. The statement will not execute.

Frage 48

Frage
What would happen if you issued a DELETE statement without a WHERE clause?
Antworten
  • All the rows in the table would be deleted.
  • An error message would be returned.
  • No rows would be deleted.
  • Only one row would be deleted.

Frage 49

Frage
A column in a table can be given a default value. This option prevents NULL values from automatically being assigned to the column if a row is inserted without a specified value for the column. True or False?
Antworten
  • True
  • False

Frage 50

Frage
Multi-table inserts can be conditional or unconditional. True or False?
Antworten
  • True
  • False
Zusammenfassung anzeigen Zusammenfassung ausblenden

ähnlicher Inhalt

Zivilrecht - Handelsrecht Streitigkeiten
myJurazone
Social Media im Unterricht
Laura Overhoff
Überblick Kostenrechnung
Ronmiboe
BAS 3 - Klausur- & Übungsaufgaben
Samuel Ong
PR VO Quiz
Anda Muresan
Deutsche Grammatik A1-A2
Marcus Hartmann
Vetie - Tierzucht & Genetik - Fragen Übungen
Fioras Hu
Vetie - Immuno Altfragen
V R
Vetie Radiologie VL 2013
Cedric-Bo Lüpkemann
Vetie Histopathologie 2013
Cedric-Bo Lüpkemann
Vetie - Innere Medizin (Allgemein)
Fioras Hu