1z0-007 Practice Test

Reviewed by Editorial Team
The ProProfs editorial team is comprised of experienced subject matter experts. They've collectively created over 10,000 quizzes and lessons, serving over 100 million users. Our team includes in-house content moderators and subject matter experts, as well as a global network of rigorously trained contributors. All adhere to our comprehensive editorial guidelines, ensuring the delivery of high-quality content.
Learn about Our Editorial Process
| By Sudha_test
S
Sudha_test
Community Contributor
Quizzes Created: 12 | Total Attempts: 38,126
| Attempts: 573 | Questions: 65
Please wait...
Question 1 / 65
0 %
0/100
Score 0/100
1. You need to calculate the total of all salaries in the accounting department. Which group function should you use?


(Choose only one answer)

Explanation

The question asks for the appropriate group function to calculate the total of all salaries in the accounting department. The correct answer is SUM. The SUM function is used to calculate the total of a set of values, which is exactly what is needed in this scenario. MAX and MIN functions are used to find the highest and lowest values respectively, which are not relevant to calculating the total. COUNT function is used to count the number of values, not their sum. TOTAL and LARGEST are not valid group functions.

Submit
Please wait...
About This Quiz
1z0-007 Practice Test - Quiz

This practice test for the Oracle 1z0-007 certification assesses skills in SQL database management, focusing on roles, subqueries, and table operations. It's essential for those aiming to excel... see morein database administration and management roles. see less

2. In a SELECT statement that includes a WHERE clause, where is the GROUP BY clause placed in the SELECT statement?


(Choose only one answer)

Explanation

The GROUP BY clause is placed after the WHERE clause in a SELECT statement. This is because the WHERE clause is used to filter the rows before grouping them, and the GROUP BY clause is used to group the rows based on a specific column or expression. By placing the GROUP BY clause after the WHERE clause, the query ensures that the filtering is applied before the grouping is done.

Submit
3. Which SQL statement would you use to remove a view called EMP_DEPT_VU from your schema?

(Choose only one answer)

Explanation

The correct answer is DROP VIEW emp_dept_uv; because the DROP VIEW statement is used to remove a view from the database schema. In this case, the view named EMP_DEPT_VU is being removed.

Submit
4. Evaluate these two SQL statements:
SELECT last_name, salary , hire_date FROM EMPLOYEES ORDER BY salary DESC;

SELECT last_name, salary, hire_date FROM EMPLOYEES ORDER BY 2 DESC;
What is true about them?

(Choose only one answer)

Explanation

The two SQL statements produce identical results because they both select the last_name, salary, and hire_date columns from the EMPLOYEES table and order them in descending order based on the salary column. The second statement uses the shorthand notation "ORDER BY 2 DESC" where the number 2 represents the second column in the SELECT statement, which is the salary column.

Submit
5. Which is an SQL*Plus command?

(Choose only one answer)

Explanation

The correct answer is "DESCRIBE". The DESCRIBE command is used in SQL*Plus to display the structure of a table, including its columns, data types, and constraints. This command is helpful for understanding the schema of a table and its relationships with other tables in a database. It provides essential information about the table's structure, allowing users to analyze and query the data effectively.

Submit
6. Examine the description of the EMPLOYEES table: EMP_ID NUMBER(4) NOT NULL LAST_NAME VARCHAR2(30) NOT NULL FIRST_NAME VARCHAR2(30) DEPT_ID NUMBER(2) JOB_CAT VARCHARD2(30) SALARY NUMBER(8,2)
Which statement shows the maximum salary paid in each job category of each department?



(Choose only one answer)

Explanation

The correct answer is: SELECT dept_id, job_cat, MAX(salary) FROM employees GROUP BY dept_id,job_cat;

This statement uses the GROUP BY clause to group the data by department and job category. Then, it uses the MAX function to calculate the maximum salary within each group. This will give the maximum salary paid in each job category of each department.

Submit
7. Which statement explicitly names a constraint?

(Choose only one answer)

Explanation

The statement "ALTER TABLE student_grades ADD CONSTRAINT student_id_fk FOREIGN KEY (student_id) REFERENCES students (student_id);" explicitly names a constraint by using the keyword "CONSTRAINT" followed by the name "student_id_fk". It also specifies that this constraint is a foreign key constraint by using the keyword "FOREIGN KEY" and references the "student_id" column in the "students" table.

Submit
8. What is true about the WITH GRANT OPTION clause?


(Choose only one answer)

Explanation

The WITH GRANT OPTION clause allows the grantee to grant object privileges to other users and roles. This means that the grantee has the authority to give permissions to other individuals or roles, allowing them to access and manipulate the specified object. This clause is commonly used in database management systems to delegate authority and control over database objects to different users and roles.

Submit
9. Scott issues the SQL statements:

CREATE TABLE dept
(deptno NUMBER(2),
dname VARCHAR2(14),
loc VARCHAR2(13)};


GRANT SELECT ON DEPT TI SUE;


If Sue needs to select from Scott's DEPT table, which command should she use?

(Choose only one answer)

Explanation

The correct answer is "SELECT * FROM SCOTT.DEPT;". This is because Sue needs to select from Scott's DEPT table, and to do so she needs to specify the schema name (SCOTT) and the table name (DEPT) using the dot notation. The other options either do not specify the schema or the table name correctly.

Submit
10. Which statement creates a new user?

(Choose only one answer)

Explanation

The statement "CREATE USER susan IDENTIFIED BY blue;" creates a new user named "susan" with the password "blue".

Submit
11. Examine the structure of the EMP_DEPT_VU view: Column Name Type Remarks

EMPLOYEE_IDNUMBER From the EMPLOYEES table EMP_NAME VARCHAR2(30) From the EMPLOYEES table

JOB_ID VARCHAR2(20) From the EMPLOYEES table SALARY NUMBER From the EMPLOYEES  table

DEPARTMENT_ID NUMBER From the DEPARTMENTS table DEPT_NAME VARCHAR2(30) From the DEPARTMENTS table


Which SQL statement produces an error?

(Choose only one answer)

Explanation

The given view structure includes columns that are sourced from both the EMPLOYEES and DEPARTMENTS tables. The SELECT statements provided in the options are all valid and do not contain any errors. Therefore, none of the statements produce an error; all are valid.

Submit
12. 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?

(Choose only one answer)

Explanation

When the main query is executed, it fails because a multiple-row subquery cannot be used with the comparison operator "=" in the WHERE clause. This is because the comparison operator "=" expects a single value, but the subquery is returning multiple rows. Therefore, the main query cannot be executed successfully.

Submit
13. Which SQL statement accepts user input for the columns to be displayed, the table name, and WHERE condition?


(Choose only one answer)

Explanation

The correct answer is the SQL statement that accepts user input for the columns to be displayed, the table name, and the WHERE condition. This statement allows the user to dynamically specify the columns, table name, and condition based on their requirements.

Submit
14. Which describes the default behavior when you create a table?


(Choose only one answer)

Explanation

When you create a table, the default behavior is that the table is created in your schema. This means that only you, as the creator, will have access to the table by default. Other users will need to be granted permission in order to access the table.

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

(Choose only one answer)

Explanation

If all the parentheses are removed from the calculation, the order of operations will still be followed because multiplication and addition have predefined precedence. Therefore, the result of the calculation will remain the same, and there will be no difference in the value displayed in the CALC_VALUE column.

Submit
16. Examine the structure of the EMPLOYEES table:

EMPLOYEE_ID NUMBER Primary Key
FIRST_NAME VARCHAR2(25)
LAST_NAME VARCHAR2(25)
HIRE_DATE DATE

You issue these statements:

CREATE table new_emp ( employe_id NUMBER, name VARCGAR2(30_));

INSERT INTO new_emp SELECT employee_id, last_name from employees;

Savepoint s1;

UPDATE new_emp set name = UPPER(name);

Savepoint s2;

Delete from new_emp;

Rollback to s2;

Delete from new_emp where employee_id=180;

UPDATE new_emp set name = 'James';

Rollback to s2;

UPDATE new_emp sey name = 'James' Where employee_id=180;

Rollback;

At the end of this transaction, what is true?


(Choose only one answer)

Explanation

At the end of this transaction, the table "new_emp" will have no rows. This is because the statements "DELETE from new_emp;" and "Rollback to s2;" remove all the rows from the table. The subsequent statements "DELETE from new_emp where employee_id=180;" and "UPDATE new_emp set name = 'James' Where employee_id=180;" do not have any effect as the row with employee ID 180 was already deleted. Therefore, the table remains empty.

Submit
17. You are granted the CREATE VIEW privilege. What does this allow you to do?


(Choose only one answer)

Explanation

The CREATE VIEW privilege allows the user to create a view in their own schema. This means that they can define a virtual table based on the data from one or more existing tables in their schema. The view can then be queried like a regular table, providing a customized and simplified view of the data.

Submit
18. The STUDENT_GRADES table has these columns:

STUDENT_ID NUMBER(12)
SEMESTER_END DATE
GPA NUMBER(4,3)

Which statement finds the highest grade point average (GPA) per semester?

(Choose only one answer)

Explanation

The correct answer is SELECT MAX (gpa) FROM student_grades WHERE gpa IS NOT NULL GROUP BY semester_end; This statement finds the highest grade point average (GPA) per semester by selecting the maximum GPA from the STUDENT_GRADES table, excluding any NULL values, and grouping the results by semester_end.

Submit
19. A subquery can be used to _________


(Choose only one answer).

Explanation

A subquery can be used to retrieve data based on an unknown condition. This means that the subquery can be used to filter and retrieve data from a table based on a condition that is not known in advance. The subquery is executed first to determine the condition, and then the main query is executed to retrieve the data based on that condition. This allows for more flexible and dynamic querying of data.

Submit
20. Which statement describes the ROWID data type?


(Choose only one answer)

Explanation

The ROWID data type is a hexadecimal string that represents the unique address of a row in its table. This means that each row in the table has a unique identifier in the form of a hexadecimal string. This identifier is used to locate and access the specific row in the table. The other options do not accurately describe the ROWID data type.

Submit
21. Examine the subquery:

SELECT last_name
FROM employees
WHERE salary IN (SELECT MAX(salary)
FROM employees
GROUP BY department_id);

Which statement is true?

(Choose only one answer)

Explanation

The given answer is correct because the subquery is used correctly within the main query. The subquery selects the maximum salary for each department and the main query selects the last names of employees whose salary matches the maximum salary for their respective department. The syntax of the SELECT statement is accurate and there are no errors in the query.

Submit
22. Which best describes an inline view?

(Choose only one answer)

Explanation

An inline view is a subquery that is part of the FROM clause of another query. It is used to create a temporary table-like result set that can be used in the main query. This allows for more complex and efficient querying by breaking down the problem into smaller, manageable parts. The result of the inline view is treated as a table and can be referenced in the main query just like any other table.

Submit
23. Evaluate the SQL statement: SELECT ROUND(TRUNC(MOD(1600,10),-1),2) FROM dual; What will be displayed?

(Choose only one answer)

Explanation

The SQL statement calculates the remainder of 1600 divided by 10 using the MOD function, which is 0. Then, it truncates the result to the nearest tens place using the TRUNC function, which is still 0. Finally, it rounds the result to two decimal places using the ROUND function, which remains 0. Therefore, the result displayed will be 0.

Submit
24. In which scenario would index be most useful?

(Choose only one answer)

Explanation

In scenarios where the indexed column contains a wide range of values, indexing would be most useful. This is because indexing allows for faster retrieval of data by creating a data structure that organizes the values in the indexed column. When the indexed column contains a wide range of values, it means that there is a large diversity in the values stored in that column. By indexing such a column, the database can quickly locate and retrieve specific values or ranges of values, improving the efficiency of queries and overall performance.

Submit
25. Which operator can be used with a multiple-row subquery?


(Choose only one answer)

Explanation

The NOT IN operator can be used with a multiple-row subquery. This operator is used to exclude rows that are returned by the subquery from the result set of the main query. It allows for the comparison of a value with a set of values returned by the subquery, and returns true if the value is not found in the set.

Submit
26. Examine the SQL statements that create the EMPLOYEES and DEPARTMENTS tables:

CREATE TABLE departments
(department_id NUMBER PRIMARY KEY,
department _ name VARCHAR2(30));
CREATE TABLE employees
(EMPLOYEE_ID NUMBER PRIMARY KEY,
EMP_NAME VARCHAR2(20),
DEPT_ID NUMBER REFERENCES
departments(department_id),
MGR_ID NUMBER REFERENCES
employees(employee id), JOB_ID VARCHAR2(15).

SALARY NUMBER); ON the EMPLOYEES, On the EMPLOYEES table, EMPLOYEE_ID is the primary key.

MGR_ID is the ID of managers and refers to the EMPLOYEE_ID. DEPT_ID is foreign key to DEPARTMENT_ID column of the DEPARTMENTS table. On the DEPARTMENTS table, DEPARTMENT_ID is the primary key.



Examine this DELETE statement: DELETE FROM departments WHERE department id = 40; What happens when you execute the DELETE statement?

(Choose only one answer)

Explanation

When the DELETE statement is executed, it fails because there are child records in the EMPLOYEES table with department ID 40. This means that there are employees assigned to this department, and deleting the department would result in orphaned records in the employees table. Therefore, the statement is not executed to maintain data integrity.

Submit
27. Examine the structure of the EMPLOYEES and NEW_EMPLOYEES tables:

EMPLOYEES

EMPLOYEE_ID NUMBER Primary Key
FIRST_NAME VARCHAR2 (25)
LAST_NAME VARCHAR2 (25)
HIRE_DATE DATE


NEW EMPLOYEES

EMPLOYEE_ID NUMBER Primary Key
NAME VARCHAR2 (60)

Which DELETE statement is valid?

(Choose only one answer)

Explanation

The correct answer is "DELETE FROM employees WHERE employee_id IN (SELECT employee_id FROM new_employees WHERE name = ('Carrey')'". This statement is valid because it uses the correct syntax for the DELETE statement and specifies the condition for deleting records from the "employees" table based on the employee_id values that exist in the "new_employees" table where the name is 'Carrey'.

Submit
28. Examine the structure of the EMPLOYEES and NEW_EMPLOYEES tables:
MPLOYEESEMPLOYEE_ID NUMBER Primary Key FIRST_NAME VARCHARD2(25) LAST_NAME VARCHARD2(25) HIRE_DATE DATE

NEW EMPLOYEESEMPLOYEE_ID NUMBER Primary Key NAME VARCHAR2(60)
Which UPDATE statement is valid?

(Choose only one answer)

Explanation

The correct answer is the first option: UPDATE new_employees SET name = (Select last_name|| first_name FROM employees Where employee_id =180) WHERE employee_id = 180. This statement updates the name column in the new_employees table with the concatenation of the last_name and first_name columns from the employees table, where the employee_id is 180. The WHERE clause ensures that only the row with employee_id 180 in the new_employees table is updated.

Submit
29. Examine the structure if the EMPLOYEES and NEW EMPLOYEES tables: EMPLOYEES

EMPLOYEE_ID NUMBER Primary Key FIRST_NAME VARCHAR2(25) LAST_NAME VARCHAR2(25) HIRE_DATE DATE




NEW EMPLOYEES EMPLOYEE_ID NUMBER Primary Key NAME  VARCHAR2(60)


Which MERGE statement is valid?

(Choose only one answer)

Explanation

The correct answer is the first option: "MERGE INTO new_employees c USING employees e ON (c.employee_id = e.employee_id) WHEN MATCHED THEN UPDATE SET c.name = e.first_name ||','|| e.last_name WHEN NOT MATCHED THEN INSERT VALUES(e.employee_id, e.first_name ||', '||e.last_name)." This is the valid MERGE statement because it correctly specifies the source and target tables using the USING clause, joins the tables on the employee_id column, and performs an UPDATE when a match is found and an INSERT when there is no match. The SET clause updates the name column in the new_employees table with the concatenation of the first_name and last_name columns from the employees table.

Submit
30. Examine the structure of the EMPLOYEES and DEPARTMENTS tables: EMPLOYEESColumn name

Data type Remarks EMPLOYEE_ID NUMBER NOT NULL, Primary Key EMP_NAME VARCHAR2 (30) JOB_ID VARCHAR2 (20),
 SALARY NUMBER
MGR_ID NUMBER References EMPLOYEE_ID COLUMN
DEPARTMENT ID NUMBER Foreign key to DEPARTMENT ID column of the


DEPARTMENTS table DEPARTMENTSColumn name Data type Remarks DEPARTMENT_ID NUMBER NOT NULL, Primary Key DEPARTMENT_NAME VARCHAR2(30) MGR_ID NUMBER References MGR_ID column of the EMPLOYEES table


Evaluate this SQL statement: SELECT employee_id, e.department_id, department_name, salary FROM employees e, departments d WHERE e. department_id = d.department_id; Which SQL statement is equivalent to the above SQL statement?

(Choose only one answer)

Explanation

The correct answer is the fourth option: SELECT employee_id, d.department_id, department_name, salary FROM employees e JOIN departments d ON e.department_id = d.department_id. This statement uses the JOIN keyword to combine the EMPLOYEES and DEPARTMENTS tables based on the department_id column. The SELECT clause specifies the columns to be retrieved from both tables. The ON clause specifies the condition for the join, which is matching the department_id column in both tables.

Submit
31. Which are DML statements?

Explanation

The correct answer is MERGE, UPDATE, and DELETE. These are all examples of Data Manipulation Language (DML) statements used in SQL. The MERGE statement combines multiple operations such as INSERT, UPDATE, and DELETE into a single statement. UPDATE is used to modify existing records in a table, while DELETE is used to remove records from a table. CREATE and DROP are examples of Data Definition Language (DDL) statements, not DML. COMMIT is a transaction control statement, not a DML statement.

Submit
32. Examine these statements:

CREATE ROLE registrar

GRANT UPDATE ON dtudent_grades TO registrar;

GRANT registrar to user1, user2, user3;

What does this set of SQL statements do?

(Choose only one answer)

Explanation

The given set of SQL statements creates a role called REGISTRAR and grants the UPDATE privilege on the STUDENT_GRADES object to this role. It then assigns the REGISTRAR role to three users. This means that the three users will have the ability to update the STUDENT_GRADES object.

Submit
33. You need to design a student registration database that contains several tables storing academic information.

The STUDENTS table stores information about a student. The STUDENT_GRADES table stores information about the student's grades. Both of the tables have a column named STUDENT_ID.

The  STUDENT_ID column in the STUDENTS table is a primary key.


You need to create a foreign key on the STUDENT_ID column of the STUDENT_GRADES table that points to the STUDENT_ID column of the STUDENTS table.


Which statement creates the foreign key?

(Choose only one answer)

Explanation

The correct answer is "CREATE TABLE student_grades(student_id NUMBER(12),semester_end DATE, gpa NUMBER(4,3), CONSTRAINT student_id_fk FOREIGN KEY (student_id) REFERENCES students (student_id));" This statement creates a foreign key named "student_id_fk" on the "student_id" column of the "student_grades" table. The foreign key references the "student_id" column of the "students" table, establishing a relationship between the two tables based on the "student_id" column.

Submit
34. Examine the structure of the EMPLOYEES table:

EMPLOYEE_ID NUMBER Primary Key
FIRST_NAME VARCHAR2(25)
LAST_NAME VARCHAR2(25)
DEPARTMENT_ID NUMBER
SALARY NUMBER

What is the correct syntax for an inline view?

(Choose only one answer)

Explanation

The correct syntax for an inline view is to use a subquery to create a temporary table (or view) within the main query. In this case, the subquery is used to find the maximum salary for each department in the EMPLOYEES table, and then the main query joins the EMPLOYEES table with the subquery using the department_id column. The main query selects the last_name, salary, and department_id columns from the EMPLOYEES table, as well as the maxsal column from the subquery. The WHERE clause is used to filter the results to only include rows where the salary is less than the maximum salary for the department.

Submit
35. Examine the structure if the EMPLOYEES table: Column name Data Type Remarks
 
EMPLOYEE_ID NUMBER NOT NULL, Primary Key

EMP_NAME VARCHAR2(30) JOB_ID VARCHAR2(20) NOT NULL

SAL NUMBER

MGR_ID NUMBER References EMPLOYEE_ID column

DEPARTMENT_ID NUMBER Foreign key to DEPARTMENT_ID column of the DEPARTMENTS table


You need to create a view called EMP_VU that allows the user to insert rows through the view.

Which SQL statement, when used to create the EMP_VU view, allows the user to insert rows?


(Choose only one answer)

Explanation

This SQL statement creates a view called EMP_VU that selects the columns employee_id, emp_name, job_id, and department_id from the EMPLOYEES table. It also includes a condition WHERE mgr_id IN (102, 120), which filters the rows based on the manager IDs. This allows the user to insert rows through the view, as it selects the necessary columns and includes the required condition.

Submit
36. What is necessary for your query on an existing view to execute successfully?

(Choose only one answer)

Explanation

To execute a query on an existing view successfully, it is necessary to have SELECT privileges on the view. This means that the user executing the query must have the necessary permissions to retrieve data from the view. The other options mentioned, such as the underlying tables having data or being in the same schema, are not relevant to the execution of the query on the view.

Submit
37. You are the DBA for an academic database. You need to create a role that allows a group of users to modify existing rows in the STUDENT_GRADES table.


Which set of statements accomplishes this?


(Choose only one answer)

Explanation

The correct answer is "CREATE ROLL registrar; GRANT UPDATE ON student_grant TO registrar; GRANT registrar to user 1, user2, user3;". This set of statements creates a role called "registrar" and grants the UPDATE privilege on the "student_grant" table to the role. It then grants the "registrar" role to user 1, user 2, and user 3, allowing them to modify existing rows in the "STUDENT_GRADES" table.

Submit
38. The user Sue issues this SQL statement:

GRANT SELECT ON sue. EMP TO alice WITH GRANT OPTION;

The user Alice issues this SQL statement:

GRANT SELECT ON sue. EMP TO reena WITH GRANT OPTION;

The user Reena issues this SQL statement:

GRANT SELECT ON sue. EMP TO timber;

The user Sue issues this SQL statement:

REVOKE select on sue. EMP FROM alice;

For which users does the revoke command revoke SELECT privileges on the SUE.EMP table?


(Choose only one answer)

Explanation

The revoke command revokes SELECT privileges on the SUE.EMP table for Alice, Reena, and Timber. This is because Sue initially granted SELECT privileges on the table to Alice with the GRANT OPTION. Alice then granted the same privileges to Reena with the GRANT OPTION. Finally, Reena granted the privileges to Timber without the GRANT OPTION. When Sue issues the REVOKE command to revoke SELECT privileges from Alice, it also cascades to revoke the privileges from Reena and Timber since they were granted the privileges through Alice.

Submit
39. You need to give the MANAGER role the ability to select from, insert into, and modify existing rows in the STUDENT_GRADES table.

Anyone given this MANAGER role should be able to pass those privileges on to others. Which statement accomplishes this?

Explanation

The correct answer is "GRANT select, insert, update ON student_grades TO manager WITH GRANT OPTION". This statement grants the MANAGER role the ability to select from, insert into, and modify existing rows in the STUDENT_GRADES table. The "WITH GRANT OPTION" allows anyone given this MANAGER role to pass those privileges on to others.

Submit
40. The EMPLOYEES table contains these columns:

LAST_NAME VARCHAR2 (25)
SALARY NUMBER (6,2)
COMMISSION_PCT NUMBER (6)

You need to write a query that will produce these results:

1 Display the salary multiplied by the commission_pct.

2 Exclude employees with a zero commission_pct.

3 Display a zero for employees with a null commission value.

Evaluate the SQL statement:

SELECT LAST_NAME, SALARY*COMMISSION_PCT

FROM EMPLOYEES

WHERE COMMISSION_PCT IS NOT NULL;

What does the statement provide?


(Choose only one answer)

Explanation

The SQL statement SELECT LAST_NAME, SALARY*COMMISSION_PCT FROM EMPLOYEES WHERE COMMISSION_PCT IS NOT NULL; provides one of the desired results, which is to display the salary multiplied by the commission_pct. It also excludes employees with a zero commission_pct. However, it does not display a zero for employees with a null commission value.

Submit
41. Evaluate the SQL statement: 1 SELECT a.emp_name, a.sal, a.dept_id, b.maxsal

2 FROM employees a,
3 (SELECT dept_id, MAX(sal) maxsal
4. FROM employees 5 GROUP BY dept_id) b 6 WHERE a.dept_id = b.dept_id 7 AND a. asl < b.maxsal;


What is the result of the statement?

(Choose only one answer)

Explanation

The SQL statement uses a subquery to find the maximum salary for each department and then joins it with the employees table using the department ID. The condition in the WHERE clause filters out employees whose salary is less than the maximum salary in their department. Therefore, the statement returns the employee name, salary, department ID, and maximum salary earned in the department of the employee for all employees who earn less than the maximum salary in their department.

Submit
42. Which statements about creating constraints are true?


Explanation

Constraints can be created after the table is created and can also be created at the same time the table is created.

Submit
43. The CUSTOMERS table has these columns:

CUSTOMER_ID NUMBER(4) NOT NULL

CUSTOMER_NAME VARCHAR2(100) NOT NULL

STREET_ADDRESS VARCHAR2(150)

CITY_ADDRESS VARCHAR2(50)

STATE_ADDRESS VARCHAR2(50)

PROVINCE_ADDRESS VARCHAR2(50)

COUNTRY_ADDRESS VARCHAR2(50)

POSTAL_CODE VARCHAR2(12)
CUSTOMER_PHONE VARCHAR2(20)

The CUSTOMER_ID column is the primary key for the table.

Which statements find the number of customers?

Explanation

The correct answers for finding the number of customers are "SELECT COUNT(*) FROM customer;" and "SELECT COUNT(customer_id) FROM customer;". The COUNT function is used to count the number of rows in a table. The asterisk (*) in "COUNT(*)" counts all rows in the table, while "COUNT(customer_id)" counts the number of non-null values in the customer_id column, which is the primary key for the table. The other statements are incorrect because they use invalid syntax or count columns that are not suitable for counting the number of customers.

Submit
44. Which are correct guidelines for naming database tables?

Explanation

The guidelines for naming database tables include the following: the name must be 1-30 characters long, it should not be an Oracle Server reserved word, it must contain only A-Z, a-z, 0-9, _, $, and #, and it must begin with a letter. These guidelines ensure that the table names are within a reasonable length, avoid conflicts with reserved words, follow a specific character set, and start with a letter for clarity and consistency.

Submit
45. Which  subqueries work?

Explanation

The given correct answers are the queries that utilize subqueries correctly. In the first query, it selects all the employees whose salary is greater than the minimum salary in their respective departments. The second query selects all the employees whose salary is equal to the average salary in their respective departments. The third query selects all the distinct department IDs where the salary is greater than any average salary in any department. The fourth query selects the department IDs where the salary is greater than the average salary in all departments. The fifth query selects the last names of employees whose salary is greater than the maximum salary in any department.

Submit
46. Examine the structure of the STUDENTS table:

STUDENT_ID NUMBER NOT NULL, Primary Key
STUDENT_NAME VARCHAR2(30)
COURSE_ID VARCHAR2(10) NOT NULL
MARKS NUMBER
START_DATE DATE FINISH_DATE DATE

You need to create a report of the 10 students who achieved the highest ranking in the course INT SQL and who completed the course in the year 1999.


Which SQL statement accomplishes this task?

(Choose only one answer)

Explanation

The correct answer is the fourth option. This SQL statement selects the student ID, marks, and assigns a row number as "Rank" for each student from the subquery. The subquery selects the student ID and marks from the STUDENTS table and orders them in descending order based on the marks. The outer query then filters the results based on the row number, selecting only the top 10 students. This will give a report of the 10 students who achieved the highest ranking in the INT SQL course and completed it in the year 1999.

Submit
47. Mary has a view called EMP_DEPT_LOC_VU that was created based on the EMPLOYEES, DEPARTMENTS, and LOCATIONS tables. She granted SELECT privilege to Scott on this view.


Which option enables Scott to eliminate the need to qualify the view with the name MARY .EMP_DEP_LOC_VU each time the view is referenced?

(Choose only one answer)

Explanation

By creating a synonym for the view EMP_DEPT_LOC_VU using the command "CREATE SYNONYM EDL_VU FOR mary.EMP_DEPT_LOC_VU", Scott can eliminate the need to qualify the view with the name MARY.EMP_DEP_LOC_VU each time it is referenced. This allows Scott to simply prefix the columns with the synonym EDL_VU when using the view.

Submit
48. Which four are types of functions available in SQL?

Explanation

The question is asking for the types of functions available in SQL. The correct answer is character, numeric, date, and conversion. These are all valid types of functions that can be used in SQL queries.

Submit
49. Which SQL statement defines the FOREIGN KEY constraint on the DEPTNO column of the EMP table?



(Choose only one answer)

Explanation

The correct answer is the third option: CREATE TABLE EMP
(empno NUMBER(4),
ename VARCNAR2(35),
deptno NUMBER(7,2)
CONSTRAINT emp_deptno_fk REFERENCES dept (deptno)).

This statement defines the FOREIGN KEY constraint on the DEPTNO column of the EMP table. It specifies the constraint name "emp_deptno_fk" and references the DEPTNO column of the DEPT table.

Submit
50. In which two cases would you use an outer join?


Explanation

An outer join is used in two cases: when the columns being joined have NULL values and when the tables being joined have both matched and unmatched data. In the first case, an outer join includes NULL values from one table even if there is no matching value in the other table. In the second case, an outer join includes all the matched data as well as any unmatched data from one or both tables. This allows for a more comprehensive analysis of the data and ensures that no information is excluded from the result set.

Submit
51. Examine the structure of the EMPLOYEES table:

EMPLOYEE_ID NUMBER NOT NULL, Primary Key

EMP_NAME VARCHAR2(30)

JOB_ID NUMBER

SAL NUMBER

MGR_ID NUMBER References EMPLOYEE_ID column

DEPARTMENT_ID NUMBER Foreign key to DEPARTMENT_ID column of the
DEPARTMENTS table

You created a sequence called EMP_ID_SEQ in
orderto populate sequential values for the EMPLOYEE_ID column of the EMPLOYEES table.

Which statements regarding the EMP_ID_SEQ sequence are true?

Explanation

The EMP_ID_SEQ sequence is not affected by modifications to the EMPLOYEES table because it is created separately and is independent of the table. Any other column of NUMBER data type in the schema can use the EMP_ID_SEQ sequence because sequences can be used to populate any column of compatible data type in the schema.

Submit
52. Examine the statement:

GRANT select, insert, update ON student_grades TO manager WITH GRANT OPTION;
Which are true?

Explanation

The statement "GRANT select, insert, update ON student_grades TO manager WITH GRANT OPTION" allows the MANAGER to pass the specified privileges on to other users. It also allows the MANAGER the ability to select from, insert into, and update the STUDENT_GRADES table.

Submit
53. Examine the description of the CUSTOMERS table

CUSTOMER_ID NUMBER(4) NOT NULL
CUSTOMER_NAME VARCHAR2(100) NOT NULL
STREET_ADDRESS VARCHAR2(150)
CITY_ADDRESS VARCHAR2(50)
STATE_ADDRESS VARCHAR2(50)
PROVINCE_ADDRESS VARCHAR2(50)
COUNTRY_ADDRESS VARCHAR2(50)
POSTAL_CODE VARCHAR2(12)
CUSTOMER_PHONE VARCHAR2(20)

The CUSTOMER_ID column is the primary key for the table.

Which statement returns the city address and the number of customers in the cities Los Angeles or San Francisco?

(Choose only one answer)

Explanation

The given answer is correct because it selects the city_address and counts the number of customers in the cities Los Angeles and San Francisco. It uses the WHERE clause to filter the rows where the city_address is either 'Los Angeles' or 'San Francisco'. The GROUP BY clause is used to group the results by city_address and customer_id, which allows for the count of customers in each city to be calculated accurately.

Submit
54. In which four clauses can a subquery be used?

Explanation

A subquery can be used in the FROM clause of a SELECT statement to create a temporary table that can be used in the main query. It can also be used in the WHERE clause of a SELECT statement to filter the results based on the subquery's conditions. Additionally, a subquery can be used in the SET clause of an UPDATE statement to assign a value to a column based on the result of the subquery. Lastly, a subquery can be used in the VALUES clause of an INSERT statement to insert values into a table based on the result of the subquery.

Submit
55. What is true about sequences?(Choose only one answer)

Explanation

In sequences, the start value is not always 1. It can be any number depending on the pattern or rule of the sequence. Therefore, the given answer is incorrect.

Submit
56. Which statements about subqueries are true?

Explanation

The first statement is false because a single row subquery can retrieve data from multiple tables. The second statement is true as a SQL query statement cannot display data from a table referred to in its subquery unless that table is included in the main query's FROM clause.

Submit
57. Which two statements complete a transaction?

(Choose only one answer)

Explanation

The two statements that complete a transaction are "ROLLBACK TO SAVE POINT C;" and "ALTER TABLE employees SET UNUSED COLUMN sal;". The "ROLLBACK TO SAVE POINT C;" statement allows the transaction to be rolled back to a specific save point, undoing any changes made after that point. The "ALTER TABLE employees SET UNUSED COLUMN sal;" statement modifies the table "employees" by setting the column "sal" as unused, indicating that it will no longer be used in any operations.

Submit
58. You need to modify the STUDENTS table to add a primary key on the STUDENT_ID column. The table is currently empty.
Which statement accomplishes this task?

(Choose only one answer)

Explanation

The correct answer is "ALTER TABLE students ADD CONSTRAINT stud _ id _pk PRIMARY KEY (student _ id);". This statement adds a constraint named "stud _ id _pk" to the "students" table, specifying that the "student _ id" column should be the primary key. This ensures that each value in the "student _ id" column will be unique and not null, thereby fulfilling the requirement of adding a primary key to the table.

Submit
59. Which statements about subqueries are true?

Explanation

A single row subquery can retrieve only one row but many columns. This means that the subquery can return multiple values in a single row, but it will only retrieve one row of data.

A multiple row subquery can retrieve multiple rows and multiple columns. This means that the subquery can return multiple rows of data, and each row can contain multiple columns.

A multiple row subquery can be compared by using the ">" operator. This means that the subquery can be used in a comparison statement where the ">" operator is used to compare the subquery result with another value.

Submit
60. The DBA issues this SQL command:

CREATE USER scott IDENTIFIED by tiger;

What privileges does the user Scott have at this point?

(Choose only one answer)

Explanation

The SQL command "CREATE USER scott IDENTIFIED by tiger" creates a new user named "scott" with the password "tiger". However, by default, the newly created user does not have any privileges assigned to them. Therefore, at this point, the user "Scott" only has the CONNECT privilege, which allows them to connect to the database but does not grant any additional privileges such as SELECT or any other privileges that a default user might have.

Submit
61. Evaluate the SQL statement:

TRUNCATE TABLE DEPT;

Which three are true about the SQL statement?

Explanation

The given correct answer states that the SQL statement "TRUNCATE TABLE DEPT" does not release the storage space used by the table. Additionally, it mentions that the user must be the owner of the table or have DELETE ANY TABLE system privileges to truncate the DEPT table. Lastly, it states that the deletion of rows cannot be rolled back after the statement executes.

Submit
62. Which  statements are true about constraints?

Explanation

The first statement is true because the UNIQUE constraint does not allow duplicate values and therefore does not permit a null value for the column. The second statement is false because a UNIQUE index is only created for columns with a UNIQUE constraint, not for columns with a PRIMARY KEY constraint. The third statement is true because both the PRIMARY KEY and FOREIGN KEY constraints create a UNIQUE index. The fourth statement is true because the NOT NULL constraint ensures that null values are not allowed for the column.

Submit
63. You created a view called EMP_DEPT_VU that contains three columns from the EMPLOYEES and DEPARTMENTS tables:
EMPLOYEE_ID, EMPLOYEE_NAME AND DEPARTMENT_NAME.

The DEPARTMENT_ID column of the EMPLOYEES table is the foreign key to the primary key DEPARTMENT_ID column of the DEPARTMENTS table.
You want to modify the view by adding a fourth column, MANAGER_ID of NUMBER data type from the EMPLOYEES tables. How can you accomplish this task?

(Choose only one answer)

Explanation

To modify the view by adding a fourth column, the existing view must be removed first. Then, the CREATE VIEW command can be used with a new column list to modify the view. This process ensures that the view is updated with the desired changes.

Submit
64. Which are attributes of single row functions?

Explanation

Single row functions are functions that manipulate data items and act on each row returned. They return one result per row and accept only one argument and return only one value. These functions can accept arguments which can be a column or an expression. They cannot be nested.

Submit
65. You need to create a table named ORDERS that contain four columns:

1 an ORDER_ID column of number data type

2 aCUSTOMER_ID column of number data type

3 an ORDER_STATUS column that contains a character data type

4 aDATE_ORDERED column to contain the date the order was placed.

When a row is inserted into the table, if no value is provided when the order was placed, today's date should be used instead. Which statement accomplishes this?

(Choose only one answer)

Explanation

The correct answer is "CREATE TABLE orders (
order_id NUMBER (10),
customer_id NUMBER (8),
order_status NUMBER (10),
date_ordered DATE = SYSDATE);"

This statement creates a table named ORDERS with four columns: ORDER_ID of number data type, CUSTOMER_ID of number data type, ORDER_STATUS of number data type, and DATE_ORDERED of date data type. The DATE_ORDERED column is set to the current date (SYSDATE) as the default value, so if no value is provided when inserting a row, today's date will be used instead.

Submit
View My Results

Quiz Review Timeline (Updated): Mar 21, 2023 +

Our quizzes are rigorously reviewed, monitored and continuously updated by our expert board to maintain accuracy, relevance, and timeliness.

  • Current Version
  • Mar 21, 2023
    Quiz Edited by
    ProProfs Editorial Team
  • Nov 18, 2010
    Quiz Created by
    Sudha_test
Cancel
  • All
    All (65)
  • Unanswered
    Unanswered ()
  • Answered
    Answered ()
You need to calculate the total of all salaries in the accounting...
In a SELECT statement that includes a WHERE clause, where is the GROUP...
Which SQL statement would you use to remove a view called EMP_DEPT_VU...
Evaluate these two SQL statements: ...
Which is an SQL*Plus command?(Choose only one answer)
Examine the description of the EMPLOYEES table: ...
Which statement explicitly names a constraint?(Choose only one answer)
What is true about the WITH GRANT OPTION clause?(Choose only one...
Scott issues the SQL statements:CREATE TABLE dept(deptno...
Which statement creates a new user?(Choose only one answer)
Examine the structure of the EMP_DEPT_VU view: Column Name Type...
You define a multiple-row subquery in the WHERE clause of an SQL query...
Which SQL statement accepts user input for the columns to be...
Which describes the default behavior when you create a table?(Choose...
Evaluate this SQL statement: ...
Examine the structure of the EMPLOYEES table:EMPLOYEE_ID NUMBER...
You are granted the CREATE VIEW privilege. What does this allow you to...
The STUDENT_GRADES table has these columns:STUDENT_ID...
A subquery can be used to _________(Choose only one answer).
Which statement describes the ROWID data type?(Choose only one answer)
Examine the subquery:SELECT last_nameFROM employeesWHERE salary IN...
Which best describes an inline view?(Choose only one answer)
Evaluate the SQL statement: ...
In which scenario would index be most useful?(Choose only one answer)
Which operator can be used with a multiple-row subquery?(Choose only...
Examine the SQL statements that create the EMPLOYEES and DEPARTMENTS...
Examine the structure of the EMPLOYEES and NEW_EMPLOYEES...
Examine the structure of the EMPLOYEES and NEW_EMPLOYEES tables: ...
Examine the structure if the EMPLOYEES and NEW EMPLOYEES tables: ...
Examine the structure of the EMPLOYEES and DEPARTMENTS tables:...
Which are DML statements?
Examine these statements:CREATE ROLE registrarGRANT UPDATE ON...
You need to design a student registration database that contains...
Examine the structure of the EMPLOYEES table:EMPLOYEE_ID NUMBER...
Examine the structure if the EMPLOYEES table: Column name Data Type...
What is necessary for your query on an existing view to execute...
You are the DBA for an academic database. You need to create a role...
The user Sue issues this SQL statement:GRANT SELECT ON sue. EMP TO...
You need to give the MANAGER role the ability to select from, insert...
The EMPLOYEES table contains these columns:LAST_NAME VARCHAR2...
Evaluate the SQL statement: ...
Which statements about creating constraints are true?
The CUSTOMERS table has these columns:CUSTOMER_ID NUMBER(4) NOT...
Which are correct guidelines for naming database tables?
Which  subqueries work?
Examine the structure of the STUDENTS table: STUDENT_ID NUMBER NOT...
Mary has a view called EMP_DEPT_LOC_VU that was created based on the...
Which four are types of functions available in SQL?
Which SQL statement defines the FOREIGN KEY constraint on the DEPTNO...
In which two cases would you use an outer join?
Examine the structure of the EMPLOYEES table:EMPLOYEE_ID NUMBER NOT...
Examine the statement:GRANT select, insert, update ON student_grades...
Examine the description of the CUSTOMERS tableCUSTOMER_ID NUMBER(4)...
In which four clauses can a subquery be used?
What is true about sequences?(Choose only one answer)
Which statements about subqueries are true?
Which two statements complete a transaction?(Choose only one answer)
You need to modify the STUDENTS table to add a primary key on the...
Which statements about subqueries are true?
The DBA issues this SQL command:CREATE USER scott IDENTIFIED by...
Evaluate the SQL statement:TRUNCATE TABLE DEPT;Which three are true...
Which  statements are true about constraints?
You created a view called EMP_DEPT_VU that contains three columns from...
Which are attributes of single row functions?
You need to create a table named ORDERS that contain four columns:1 an...
Alert!

Advertisement