Quiz
Oracle SQL2
Create a free account to finish this quiz
Save your progress and see your final score.
Already have an account? Sign in
Questions in this quiz (21)
1You 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?
- AALTER TABLE students ADD CONSTRAINT stud_id_pk PRIMARY KEY student_id;
- BALTER TABLE students MODIFY CONSTRAINT stud_id_pk PRIMARY KEY (student_id);
- CALTER TABLE students ADD PRIMARY KEY student_id;
- DALTER TABLE students ADD CONSTRAINT PRIMARY KEY (student_id);
- EALTER TABLE students ADD CONSTRAINT stud_id_pk PRIMARY KEY (student_id);
2An entity-relationship diagram shows data modeled into
(Choose the best answer.)- ATwo-dimensional tables
- BHierarchical structures
- CObject-oriented structures
- DMultidimensional tables
3Which actions are allowed on a table that is marked as read-only?
- ADropping a table
- BTruncating a table
- CInserting new data
- DDropping a constraint
- EDropping an index
4SQL is a set-oriented language. Which of these features is a consequence of this?
(Choose the best answer.)- AIndividual rows must have a unique identifier.
- BOne statement can affect multiple rows.
- CSQL statements can be placed within blocks of code in other languages, such as Java and PL/SQL.
- DSets of users can be managed in groups.
5Which statements are true regarding the WHERE and HAVING clauses in a SELECT statement?
(Choose all that apply.)- AThe HAVING clause can be used with aggregate functions in subqueries.
- BThe aggregate functions and columns used in the HAVING clause must be specified in the SELECT list of the query.
- CThe WHERE clause can be used to exclude rows before dividing them into groups.
- DThe WHERE clause can be used to exclude rows after dividing them into groups.
- EThe WHERE and HAVING clauses can be used in the same statement only if they are applied to different columns in the table.
6Which three statements/commands would cause a transaction to end?
(Choose three.)- AROLLBACK
- BCREATE
- CSELECT
- DCOMMIT
- ESAVEPOINT
7What value is returned after executing the following statement? Take note that 01-JAN-2009 occurs on a Thursday.
SELECT NEXT_DAY('01-JAN-2009','wed') FROM DUAL;
(Choose the best answer.)- AWednesday
- B31-JAN-2009
- CNone of the above
- D07-JAN-2009
8Which two statements about the evaluation of clauses in a SELECT statement are true?
(Choose two.)- AThe Oracle Server will evaluate an ORDER BY clause before a WHERE clause.
- BThe Oracle Server will evaluate a GROUP BY clause before a HAVING clause.
- CThe Oracle Server will evaluate a WHERE clause before a GROUP BY clause.
- DThe Oracle Server will evaluate an ORDER BY clause before a HAVING clause.
- EThe Oracle Server will evaluate a HAVING clause before a WHERE clause.
9Which types of constraint require an index?
(Choose all that apply.)- ACHECK
- BPRIMARY KEY
- CUNIQUE
- DNOT NULL
10Which SQL statement will replace the last two characters of last_name with 'XX' in the employees table when executed?
- ASELECT REPLACE(last_name, SUBSTR(last_name, LENGTH(last_name)-1), 'XX') new_col FROM employees;
- BSELECT REPLACE(SUBSTR(last_name, LENGTH(last_name)-1), 'XX') new_col FROM employees;
- CSELECT RTRIM(last_name, SUBSTR(last_name, LENGTH(last_name)-1)) || 'XX' new_col FROM employees;
- DSELECT CONCAT(SUBSTR(last_name, 1,LENGTH(last_name)-2), 'XX') new_col FROM employees;
11What value is returned after executing the following statement?
SELECT TO_CHAR(1234.49, '999999.9') FROM DUAL;
(Choose the best answer.)- A001234.5
- B1234.5
- CNone of the above
- D1234.49
12CREATE TABLE(
emp_id NUMBER NOT NULL,
emp_name VARCHAR2(40) NOT NULL,
emp_image LONG
);
Which two statements are true regarding SQL statements that can be executed on the EMP_DETAIL table?
(Choose two.)- AYou cannot add a new column to the table with LONG as the data type
- BAn EMP_IMAGE column can be included in the GROUP BY clause
- CYou can alter the table to include the NOT NULL constraint on the EMP_IMAGE column
- DAn EMP_IMAGE column cannot be included in the ORDER BY clause
13If SYS DATE returns 12-JUL-2016, what is returned by the following statement?
SELECT TO_CHAR(TO_DATE(TO_CHAR(SYS DATE,'DD'),'DD'),'YEAR') FROM DUAL;
(Choose the best answer.)- A12-JUL-2016
- BNone of the above
- CTWO THOUSAND SIXTEEN
- D2016
14Which two operators are not allowed when using an outer join operator in the query?
- AIN
- BAND
- C=
- DOR
15Which statement is true regarding the INTERSECT operator?
- AIt ignores NULL values
- BThe number of columns and data types must be identical for all SELECT statements in the query
- CThe names of columns in all SELECT statements must be identical
- DReversing the order of the intersected tables the result
16What are the distinguishing characteristics of a public synonym rather than a private synonym?
(Choose two correct answers.)- APublic synonyms can have the same names as tables or views.
- BPublic synonyms can be selected from without needing any permissions.
- CPublic synonyms can be accessed by name without a schema name qualifier.
- DPublic synonyms are always visible to all users.
17You need to calculate the number of days from 1st January 2007 till date . Dates are stored in the default format of dd-mon-rr.
Which two SQL statements would give the required output?
(Choose two.)- ASELECT SYSDATE – TO_DATE(’01-JANUARY-2007′) FROM DUAL;
- BSELECT SYSDATE – TO_DATE(’01/JANUARY/2007′) FROM DUAL;
- CSELECT TO_DATE(SYSDATE, ‘DD/MONTH/YYYY’) – ’01/JANUARY/2007′ FROM DUAL;
- DSELECT SYSDATE – ’01-JAN-2007′ FROM DUAL;
- ESELECT TO_CHAR(SYSDATE, ‘DD-MON-YYYY’) – ’01-JAN-2007′ FROM DUAL;
18Which expressions do not return NULL values?
(Choose all that apply.)- Aselect null||'test'||null as “Test” from dual;
- Bselect 'this is a '||null||'test with nulls' from dual;
- Cselect ((10 + 20) * 50) + null from dual;
- Dselect null/0 from dual;
19The DBA issues this SQL command: CREATE USER scott IDENTIFIED by tiger;
What privileges does the user Scott have at this point?- Aall the privileges of a default user
- Bonly the SELECT privilege
- Cno privileges
- Donly the CONNECT privilege
20If an UPDATE or DELETE command has a WHERE clause that gives it a scope of several rows, what will happen if there is an error part way through execution?
The command is one of several in a multistatement transaction.
(Choose the best answer.)- AWhatever work the command had done before hitting the error will be rolled back, but work done already by the transaction will remain.
- BThe command will skip the row that caused the error and continue.
- CThe whole transaction will be rolled back.
- DThe command will stop at the error, and the rows that have been updated or deleted will remain updated or deleted.
21If a programmer does not request a type of lock when updating many rows in one table, what lock or locks will they be given?
(Choose the best answer.)- ANo locks at all. The default level of locking is NONE in order to maximize concurrency.
- BAn exclusive lock on the table. This is the fastest method when many rows are being updated.
- CShared locks on the table and on each row. This is the safest (although not the fastest) method.
- DAn exclusive lock on each row and a shared lock on the table. This maximizes concurrency safely.
Information
- Description
- Quiz on Oracle SQL2, created by Brandon Gagon on 09/02/2019.
- Author
- Brandon Gagon
- Language
- English
- Views
- 9
- Rating
- No ratings yet Rate this quiz