SQL and Database Fundamentals
Quiz covering SQL operations, PL/SQL programming, constraints, joins, transactions, and database concepts across Oracle and DB2 systems.
Questions
A subquery can be used to _________.
- Create groups of data
- Sort data in a specific order
- Convert data to a different format
- Retrieve data based on an unknown condition
what does the sql code -922 represents?
- query will retrieve only one row
- authorization failure
- no such code available
- rollback
choose the environments which can access DB2
- TSO
- IMC
- CICS
- None of the above
5 rows are inserted to a DB2 Table. Next 3 of those are updated, then a rollback is issued. What would happen when the rollback is issued?
- returns 5 rows
- returns 3 rows
- returns all 8rows
- none
Which are true regarding the use of outer joins?
- You cannot use IN operator in a condition that involves an outerjoin
- You use (+) on both sides of the WHERE condition to perform an outerjoin
- You use (*) on both sides of the WHERE condition to perform an outerjoin
- You use an outerjoin to see only the rows that do not meet the join condition
- In the WHERE condition, you use (+) following the name of the column in the table
- You cannot link a condition that is involved in an outerjoin to another condition by
Which two statements complete a transaction? (Choose two)
- DELETE employees;
- DESCRIBE employees;
- ROLLBACK TO SAVEPOINT C;
- GRANT SELECT ON employees TO SCOTT;
- ALTER TABLE employees SET UNUSED COLUMN sal;
- Select MAX(sal) FROM employees WHERE department_id = 20;
Which two are true about aggregate functions? (Choose two.)
- You can use aggregate functions in any clause of a SELECT statement.
- You can use aggregate functions only in the column list of the SELECT clause and in the WHERE clause of a SELECT statement.
- You can mix single row columns with aggregate functions in the column list of a SELECT statement by grouping on the single row columns.
- You can pass column names, expressions, constants, or functions as parameters to an aggregate function.
- You can use aggregate functions on a table, only by grouping the whole table as one single group.
- You cannot group the rows of a table by more than one column while using aggregate functions.
Which of the following is not a valid aggregate function
- COUNT
- SUM
- COMPUTE
- MIN
To use a FETCH staement with a cursor you always have to supply an explicit direction such next or prior.
- TRUE
- FALSE
- BOTH
- NONE
Which of the following is non-PL/SQL variable?
- Scalar
- LOB
- Reference
- host
PL/SQL does not support boolean variables
- True
- False
Which four are valid Oracle constraint types?
- CASCADE
- UNIQUE
- NONUNIQUE
- CHECK
- PRIMARY KEY
- NOT NULL
Which is an iSQL*PLUS command?
- INSERT
- UPDATE
- SELECT
- DESCRIBE
- DELETE
- RENAME
Top N analysis requires _____ and ______?(Choose two)
- the use of rowed
- a GROUP BY clause
- an ORDER BY clause
- only an inline view
- an inline view and an outer query
Which constraint can be defined only at the column level?
- UNIQUE
- NOT NULL
- CHECK
- PRIMARY KEY
- FOREIGN KEY
What does the FORCE option for creating a view do?
- creates a view with constraints
- creates a view even if the underlying parent table has constraints
- creates a view in another schema even if you don't have privileges
- creates a view regardless of whether or not the base tables exist
The user Alice wants to grant all users query privileges on her DEPT table. Which SQL statement accomplishes this?
- GRANT select ON dept TO ALL USERS;
- GRANT select ON dept TO ALL;
- GRANT QUERY ON dept TO ALL USERS;
- GRANT select ON dept TO PUBLIC;
Which three are true?(Choose three)
- A MERGE statement is used to merge the data of one table with data from another
- A MERGE statement replaces the data of one table with that of another
- A MERGE statement can be used to insert new rows into a table
- A MERGE statement can be used to update existing rows in a table
What is true about Sequences?
- Once created, a sequence belongs to a specific schema
- Once created, a sequence is linked to a specific table
- Once created, a sequence is automatically available to all users
- Only the DBA can control which squence is used by certain a table
- Once created, a sequence is automatically in all INSERT and UPDATE statements
John has created a procedure named SALARY_CALC. Which SQL query allows him to view the text of the procedure?
- SELECT text FROM user_source WHERE name ='SALARY_CALC';
- SELECT * FROM user_source WHERE source_name ='salary_calc';
- SELECT * FROM user_objects WHERE object_name = 'SALARY_CALC';
- SELECT text FROM user_source WHERE name='SALARY_CALC' AND owner ='JOHN';