Oracle Database Fundamentals and SQL

Covers core SQL concepts including queries, functions, views, subqueries, DML operations, and SQL*Plus commands for Oracle databases

20 Questions Published

Questions

Question 1 Multiple Choice (Multiple Answers)

Which are DML statements? (Choose all that apply.)

  1. COMMIT
  2. MERGE
  3. UPDATE
  4. DELETE
  5. CREATE
  6. DROP
Question 2 Multiple Choice (Multiple Answers)

Which four are correct guidelines for naming database tables? (Choose four.)

  1. Must begin with either a number or a letter
  2. Must be 1-30 characters long
  3. Should not be an Oracle Server reserved word
  4. Must contain only A-Z, a-z, 0-9, _, *, and #
  5. Must contain only A-Z, a-z, 0-9, _, $, and #
  6. Must begin with a letter
Question 3 Multiple Choice (Single Answer)

Which SQL statement generates the alias Annual Salary for the calculated column SALARY*12?

  1. SELECT ename, salary*12 'Annual Salary' FROM employees;
  2. SELECT ename, salary*12 "Annual Salary" FROM employees;
  3. SELECT ename, salary*12 AS Annual Salary FROM employees;
  4. SELECT ename, salary*12 AS INITCAP("ANNUAL SALARY") FROM employees
Question 4 Multiple Choice (Single Answer)

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

  1. =
  2. LIKE
  3. BETWEEN
  4. NOT IN
  5. Is
  6. <>
Question 5 Multiple Choice (Single Answer)

You need to display the last names of those employees who have the letter "A" as the second character in their names. Which SQL statement displays the required results?

  1. SELECT last_name FROM EMP WHERE last_name LIKE '_A%';
  2. SELECT last_name FROM EMP WHERE last name ='*A%'
  3. SELECT last_name FROM EMP WHERE last name ='_A%';
  4. SELECT last_name FROM EMP WHERE last name LIKE '*A%'
Question 6 Multiple Choice (Multiple Answers)

Which two are character manipulation functions? (Choose two.)

  1. TRIM
  2. REPLACE
  3. TRUNC
  4. TO_DATE
  5. MOD
  6. CASE
Question 7 Multiple Choice (Single Answer)

Which clause should you use to exclude group results?

  1. WHERE
  2. HAVING
  3. RESTRICT
  4. GROUP BY
  5. ORDER BY
Question 8 Multiple Choice (Single Answer)

Which is an /SQL*Plus command?

  1. INSERT
  2. UPDATE
  3. SELECT
  4. DESCRIBE
  5. DELETE
  6. RENAME
Question 9 Multiple Choice (Single Answer)

A subquery can be used to _________.

  1. create groups of data
  2. sort data in a specific order
  3. convert data to a different format
  4. Retrieve data based on an unknown condition
Question 10 Multiple Choice (Single Answer)

What does the TRUNCATE statement do?

  1. Removes the table
  2. Removes all rows from a table
  3. shortens the table to 10 rows
  4. Removes all columns from a table
  5. Removes foreign keys from a table
Question 11 Multiple Choice (Single Answer)

Which substitution variable would you use if you want to reuse the variable value without prompting the user each time?

  1. "&"
  2. ACCEPT
  3. PROMPT
  4. "&&"
Question 12 Multiple Choice (Multiple Answers)

Which two statements about views are true? (Choose two)

  1. A view can be created as read only
  2. A view can be created as a join on two or more tables.
  3. A view cannot have an ORDER BY clause in the SELECT statement
  4. A view cannot be created with a GROUP BY clause in the SELECT statement
  5. A view must have aliases defined for the column names in the SELECT statement
Question 13 Multiple Choice (Single Answer)

Management has asked you to calculate the value 12salarycommission_pct for all the employees in the EMP table. The EMP table contains these columns: LAST NAME VARCHAR2(35) NOT NULL SALARY NUMBER(9,2) NOT NULL COMMISSION_PCT NUMBER(4,2) Which statement ensures that a value is displayed in the calculated column for all employees?

  1. SELECT last_name, 12salarycommission_pct FROM emp;
  2. SELECT last_name, 12salary (commission_pct,0) FROM emp;
  3. SELECT last_name, 12salary(nvl(commission_pct,0)) FROM emp
  4. SELECT last_name, 12salary(decode(commission_pct,0)) FROM emp;
Question 14 Multiple Choice (Multiple Answers)

Examine the description of the STUDENTS table: STD_ID NUMBER(4) COURSE_ID VARCHAR2(10) START_DATE DATE END_DATE DATE Which two aggregate functions are valid on the START_DATE column? (Choose two.)

  1. SUM(start_date)
  2. AVG(start_date)
  3. COUNT(start_date)
  4. AVG(start_date, end_date)
  5. MIN(start_date)
  6. MAXIMUM(start_date)
Question 15 Multiple Choice (Single Answer)

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

  1. 0
  2. 1
  3. 0.00
  4. An error statement
Question 16 Multiple Choice (Single Answer)

Examine the description of the MARKS table: STD_ID NUMBER(4) STUDENT_NAME VARCHAR2(30) SUBJ1 NUMBER(3) SUBJ2 NUMBER(3) SUBJ1 and SUBJ2 indicate the marks obtained by a student in two subjects. Examine this SELECT statement based on the MARKS table: SELECT subj1+subj2 total_marks, std_id FROM marks WHERE subj1 > AVG(subj1) AND subj2 > AVG(subj2) ORDER BY total_marks; What is the result of the SELECT statement?

  1. The statement executes successfully and returns the student ID and sum of all marks for each student who obtained more than the average mark in each subject.
  2. The statement returns an error at the SELECT clause.
  3. The statement returns an error at the WHERE clause.
  4. The statement returns an error at the ORDER BY clause.
Question 17 Multiple Choice (Multiple Answers)

Which three SELECT statements display 2000 in the format "$2,000.00"? (Choose three.)

  1. SELECT TO_CHAR(2000, '$#,###.##') FROM dual;
  2. SELECT TO_CHAR(2000, '$0,000.00') FROM dual;
  3. SELECT TO_CHAR(2000, '$9,999.00') FROM dual;
  4. SELECT TO_CHAR(2000, '$9,999.99') FROM dual;
  5. SELECT TO_CHAR(2000, '$2,000.00') FROM dual;
  6. SELECT TO_CHAR(2000, '$N,NNN.NN') FROM dual;
Question 18 Multiple Choice (Single Answer)

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

  1. The underlying tables must have data.
  2. You need SELECT privileges on the view.
  3. The underlying tables must be in the same schema.
  4. You need SELECT privileges only on the underlying tables.
Question 19 Multiple Choice (Single Answer)

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?

  1. SELECT ENAME FROM EMP WHERE SYSDATE-HIRE_DATE > 5;
  2. SELECT ENAME FROM EMP WHERE HIRE_DATE-SYSDATE > 5;
  3. SELECT ENAME FROM EMP WHERE (SYSDATE-HIRE_DATE)/365 > 5;
  4. SELECT ENAME FROM EMP WHERE (SYSDATE-HIRE_DATE)* 365 > 5;
Question 20 Multiple Choice (Single Answer)

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?

  1. The two statements produce identical results.
  2. The second statement returns a syntax error.
  3. There is no need to specify DESC because the results are sorted in descending order by default.
  4. The two statements can be made to produce identical results by adding a column alias for the salary column in the second SQL statement.