SQL and Database Management

Covers SQL fundamentals including DDL, DML, queries, joins, subqueries, constraints, privileges, views, synonyms, and sequences in Oracle databases

19 Questions Published

Questions

Question 1 Multiple Choice (Single Answer)

The database administrator of your company created a public synonum called HR for the HUMAN_RESOURCES table of the GENERAL schema, because many users frequently use this table. As a user of the database, you created a table called HR in your schema. What happens when you execute this query?

  1. You obtain the results retrieved from the public synonym HR created by the DBA.
  2. You obtain the results retrieved from the HR table that belongs to you schema.
  3. You get an error message because you cannot retrieve from a table that has the same name as a public synonym.
  4. You obtain the results retrieved from both the publich synonym HR and the HR table that belongs to your schema, as a Cartesian product.
Question 2 Multiple Choice (Multiple Answers)

Which two statements about views are true?

  1. A view can be created as read only.
  2. A view can be created as a join of two or more tables.
  3. A view can not have an ORDER BY clause in the SELECT statement.
  4. A view can not be created with a GROUP BY clause in the SELECT statement.
Question 3 Multiple Choice (Multiple Answers)

Which three statements about SubQueries are true?

  1. A main query can have mroe than one subquery.
  2. A subquery can have more than one main query.
  3. The sub query and main query must retrieve data from the same table.
  4. The subquery and main query can retrieve data from different tables.
  5. Only one column or expression can be compared between the subquery and main query.
Question 4 Multiple Choice (Single Answer)

For which action can you use the TO_DATE function?

  1. Convert any date literal to a date.
  2. Convert any numeric literal to a date.
  3. Convert any character literal to a date.
  4. Convert any date literal to a character literal
  5. Format '10-JAN-99' to 'January 10 1999'.
Question 5 Multiple Choice (Single Answer)

What is true about sequences?

  1. The start value of the sequence is always 1.
  2. The sequence always increments by 1.
  3. The minimum value of an ascending sequence defaults to 1.
  4. The maximum value of descending sequence defaults to 1.
Question 6 Multiple Choice (Single Answer)

SCOTT user has grants on HR schema objects. You are connected to SCOTT schema and issued following command:Create synonym emp for hr.employees;What happens when you issue this statement?

  1. An error is generated.
  2. A public synonym is created for employees table.
  3. You create an alternative name for the employees table of HR schema in HR schema
  4. You create an alternative name for the employees table of HR schema in SCOTT schema
Question 7 Multiple Choice (Multiple Answers)

Examine the structure of the EMPLOYEES table: EMPLOYEE_ID NUMBER Primary Key FIRST_NAME VARCHAR2(25) LAST_NAME VARCHAR2(25) Which three statements inserts a row into the table? (Choose three)

  1. INSERT INTO employees VALUES (NULL, 'JOHN','Smith');
  2. . INSERT INTO employees( first_name, last_name) VALUES ('JOHN','Smith');
  3. INSERT INTO employees VALUES ('1000','JOHN','NULL');
  4. INSERT INTO employees(first_name,last_name, employee_id) VALUES ('1000, 'john','Smith');
  5. . INSERT INTO employees (employee_id) VALUES (1000);
  6. INSERT INTO employees (employee_id, first_name, last_name) VALUES ( 1000, 'john',");
Question 8 Multiple Choice (Single Answer)

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

  1. GRANT select, insert, update ON student_grades TO manager
  2. GRANT select, insert, update ON student_grades TO ROLE manager
  3. GRANT select, insert, modify ON student_grades TO manager WITH GRANT OPTION;
  4. GRANT select, insert, update ON student_grades TO manager WITH GRANT OPTION;
Question 9 Multiple Choice (Multiple Answers)

Which are true about aggregate functions? (Choose all that apply)

  1. You can use aggregate functions in any caluse of the SELECT statement.
  2. You can user aggregate funcitons only in column list of select clause and where clause of select statement.
  3. You can mix single row functions with aggregate functions in the column list of a SELECT statement by grouping on single row columns.
  4. You can pass column names, expressions, constants, or functions as parameter to an aggregate function.
Question 10 Multiple Choice (Single Answer)

Which one is a system privilege?

  1. SELECT
  2. DELETE
  3. EXECUTE
  4. ALTER TABLE
  5. CREATE TABLE
Question 11 Multiple Choice (Single Answer)

The database administrator of your company created a public synonym called HR for the HUMAN_RESOURCES table of the GENERAL schema, because many users frequently use this table. As a user of the database, you created a table called HR in your schema. What happens when you execute this query? SELECT * FROM HR;

  1. You obtain the results retrieved from the public synonym HR created by the database administrator.
  2. You obtain the results retrieved from the HR table that belongs to your schema
  3. You get an error message because you cannot retrieve from a table that has the same name as a public synonym
  4. You obtain the results retrieved from both the public synonym HR and the HR table that belongs to your schema, as a Cartesian product.
Question 12 Multiple Choice (Single Answer)

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?

  1. The statement produces an error at line 1.
  2. The statement produces an error at line 3
  3. The statement produces an error at line 6.
  4. The statement returns the employee name, salary, department ID, and maximum salary earned in the department of the employee for all departments that pay less salary then the maximum salary paid in the company
  5. 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.
Question 13 Multiple Choice (Single Answer)

The EMP table contains these columns: LAST NAME VARCHAR2(25) SALARY NUMBER(6,2) DEPARTMENT_ID NUMBER(6) You need to display the employees who have not been assigned to any department. You write the SELECT statement: SELECT LAST_NAME, SALARY, DEPARTMENT_ID FROM EMP WHERE DEPARMENT_ID = NULL; What is true about this SQL statement?

  1. The SQL statement displays the desired results
  2. The column in the WHERE clause should be changed to display the desired results
  3. The operator in the WHERE clause should be changed to display the desired results
  4. The WHERE clause should be changed to use an outer join to display the desired results
Question 14 Multiple Choice (Multiple Answers)

For which two constraints does the Oracle Server implicitly create a unique index? (Choose two.)

  1. NOT NULL
  2. PRIMARY KEY
  3. FOREIGN KEY
  4. CHECK
  5. UNIQUE
Question 15 Multiple Choice (Multiple Answers)

Which two statements about subqueries are true? (Choose two.)

  1. A single row subquery can retrieve data from only one table
  2. A SQL query statement cannot display data from table B that is referred to in its subquery, unless table B is included in the main query's FROM clause.
  3. A SQL query statement can display data from table B that is referred to in its subquery, without including table B in its own FROM clause.
  4. A single row subquery can retrieve data from more than one table
  5. A single row subquery cannot be used in a condition where the LIKE operator is used for comparison
  6. A multiple-row subquery cannot be used in a condition where the LIKE operator is used for comparison.
Question 16 Multiple Choice (Single Answer)

CREATE TABLE dept(deptno NUMBER(2),dname VARCNAR2(14),1oc VARCNAR2 (13));ROLLBACK;DESCRIBE DEPTWhat is true about the set?

  1. The DESCRIBE DEPT statement displays the structure of the DEPT table
  2. The ROLLBACK statement frees the storage space occupies by the DEPT table
  3. The DESCRIBE DEPT statement returns an error ORA-04043: object DEPT does not exist
  4. The DESCRIBE DEPT statement displays the structure of the DEPT table only if there is a COMMIT statement introduced before the ROLLBACK statement.
Question 17 Multiple Choice (Single Answer)

You added a PHONE_NUMBER column of NUMBER data type to an existing EMPLOYEES table. The EMPLOYEES table already contains records of 100 employees. Now, you want to enter the phone numbers of each of the 100 employees into the table. Some of the employees may not have a phone number available. Which data manipulation operation do you perform?

  1. MERGE
  2. INSERT
  3. UPDATE
  4. ADD
  5. ENTER
Question 18 Multiple Choice (Single Answer)

In which case would you use a FULL OUTER JOIN?

  1. Both tables have NULL values
  2. You want all unmatched data from one table
  3. You want all matched data from both tables
  4. You want all unmatched data from both tables
  5. One of the tables has more data than the other
  6. You want all matched and unmatched data from only one table
Question 19 Multiple Choice (Single Answer)

Which type of record is the fastest to access?

  1. Index Sequential
  2. Via Set
  3. Calc
  4. Direct