Test Your SQL Basics - Part_3

Manipulating Data Questions

1. What all operations can MERGE statement perform in SQL?
  1. INSERT
  2. DELETE
  3. GROUP BY
  4. None of the above

2.Which of following commands is a DDL (Data Definition Language) command but is often considered along with DML commands?
  1. DELETE
  2. INSERT
  3. TRUNCATE
  4. None of the above

3. What among the following is a TRUNCATE statement equivalent to? (Choose the most suitable answer)
  1. To a DELETE statement
  2. To an UPDATE statement
  3. A DELETE statement without a WHERE clause
  4. None of the above

4.Which of the following situations indicate that a DML operation has taken place?
  1. When new rows are added to a table
  2. When two queries are combined
  3. When a table is truncated
  4. None of the above

5.What is true about the keyword VALUES in INSERT statements?
  1. VALUES can add multiple rows at a time during the INSERT
  2. VALUES can add only 100 rows at a time during the INSERT
  3. VALUES is mandatory to be used if we use the keyword INSERT
  4. VALUES add only one row at a time

6. Which of the following commands is used to save the changed data in a table permanently?
  1. ROLLBACK
  2. COMMIT
  3. INSERT
  4. UPDATE

7. Which of the following commands / statements would end a transaction?
  1. COMMIT
  2. SELECT
  3. SAVEPOINT
  4. CREATE

8.What happens when a transaction is committed?
  1. The changes made during the transaction are saved for a particular user session
  2. The changes made during the transaction are discarded
  3. If the transaction is a DDL, the commit doesn't work
  4. None of the above

9. Which of the following reasons will the best one on the usage of string?
  1. Using sub-queries
  2. Syntax errors
  3. Access permissions
  4. Constraint violations




Using DDL Statements Questions

1.DDL statements are used for which of the following Oracle database objects?
  1. Tables
  2. Sub-queries
  3. Rows
  4. Columns

2.What is the basic unit of storage in Oracle Database that contains data?
  1. View
  2. Column
  3. Query
  4. Table

3.Which of the following database objects improves the performance of some queries?
  1. Table
  2. Synonym
  3. View
  4. Index

4. When a table can be created?
  1. When the database is not being used by any user
  2. When the database is newly created
  3. It can be created any time, even when a user is using the database
  4. None of the above

5. What is true about a table?
  1. It is not mandatory to specify the size of a table
  2. The size of each table is the same
  3. A table can be modified online
  4. None of the above

6. A table named 123_A is created for storing the number of employees in an organization. What is wrong in the name of the table?
  1. The name of a table cannot start with a digit
  2. Nothing is wrong in this name.
  3. You cannot use an underscore while naming a table
  4. None of the above

7. What among the following are the pre-requisites for creating a table?
  1. CREATE TABLE privilege
  2. Storage space
  3. Data in the table
  4. None of the above

8. What is the syntax for creating a table?
  1. CREATE TABLE [schema.] table (column datatype [DEFAULT expr] [,..] );
  2. CREATE TABLE INTO [schema.] table (column datatype [DEFAULT expr] [,..] );
  3. CREATE TABLE VALUES [schema.] table (column datatype [DEFAULT expr] [,..] );
  4. None of the above

9. What is true about a namespace?
  1. It is a group of object types
  2. Within a namespace, all the object names should be uniquely identified by schema and name
  3. The same type of objects in different namespaces can share the same name
  4. All of the above

10. Which of the following object types share the same namespace?
  1. Synonyms
  2. Table
  3. Views
  4. All of the above

11. Which of the following are the data types for date and time data?
  1. TIMESTAMP
  2. INTERVAL DAY TO SECOND
  3. TIMESTAMP WITH LOCAL TIMEZONE
  4. All of the above

12. Which of the following data types are for large objects?
  1. CLOB
  2. BLOB
  3. RAW
  4. All of the above

13. What will happen if the inserted value is of a smaller length as defined for a VARCHAR2 data type column?
  1. It will throw an ORA error
  2. It will get inserted successfully and the value will take up as much space as it needs.
  3. It will get inserted and the remaining space will be padded with spaces
  4. None of the above

14. What happens when a table which is marked Read Only is attempted for drop?
  1. It will throw an error
  2. It will no longer remain Read Only but cannot be dropped either
  3. It will be dropped without errors
  4. It will remain un-touched

15. Which of the following data types cannot be used with a GROUP BY and an ORDER BY clause?
  1. CLOB
  2. VARCHAR2
  3. CHAR
  4. LONG

16. How many LONG columns can a table contain?
  1. None
  2. Maximum 2
  3. Minimum 2
  4. Only one





Creating Other Schema Objects Questions

1. What among the following is true about synonyms?
  1. PUBLIC and PRIVATE synonyms can have the same name for the same table
  2. DROP SYNONYM will remove a synonym
  3. DROP PUBLIC SYNONYM can be executed only by a SYSDBA
  4. None of the above

2. What is true about creating a view? (Choose the most appropriate answer)
  1. A view can only be created from a table
  2. A view can only be created from one table
  3. A view can be created from one or many tables or views
  4. None of the above

3. Which of the following privileges are required to create views in one's own schema?
  1. CREATE TABLE system privilege
  2. CREATE VIEW system privilege
  3. ALTER VIEW system privilege
  4. CREATE ANY VIEW system privilege

4.How is a view stored in the data dictionary?
  1. As a WHERE clause
  2. As a CREATE statement
  3. As an UPDATE statement
  4. As a SELECT statement

5.Which of the following can contain single-row functions?
  1. Inline Views
  2. Simple Views
  3. Complex Views
  4. Composite Views

6.When can the rows from a view be removed?
  1. Deletion of rows through a view is not possible
  2. It should be a simple view
  3. It should be a complex view
  4. None of the above

7.When can the data in a view not be modified?
  1. When there are group expressions
  2. When there is a GROUP BY clause
  3. When ROWNUM is used in the view query
  4. All of the above

8.What is true about the WITH CHECK CONSTRAINT?
  1. INSERTs or UPDATEs performed through the view cannot create rows that the view cannot select
  2. Only INSERTs performed through the view cannot create rows that the view cannot select
  3. Only UPDATEs performed through the view cannot create rows that the view cannot select
  4. None of the above

9.How can you prevent DML operations on a View?
  1. By defining a WITH CHECK OPTION constraint
  2. By defining a WITH READ ONLY option
  3. Neither of A nor B
  4. None of the above

10.What is true about the above statement?
  1. The view will not be created
  2. INSERT operation on this view an will throw an ORA error
  3. On UPDATING the rows for all the employees in department 100, an ORA error will be thrown
  4. None of the above

11.How many rows can be deleted from the view as shown above?
  1. All rows of the view
  2. All the rows of only the department 100
  3. No rows
  4. None of the above

12.What is true about sequences?
  1. It generates integers
  2. It is a shareable object
  3. Can be used to create a PRIMARY KEY value
  4. All of the above

13.What can be the last value generated by this sequence?
  1. 0
  2. 100
  3. 101
  4. 9999

14.What is true about NEXTVAL pseudo column?
  1. It re-generates the CURRVAL of a sequence
  2. It returns the next available sequence value
  3. It can return duplicate values
  4. It generates the same values for different users

15.What is true about CURRVAL pseudo column?
  1. CURRVAL can be used before NEXTVAL with respect to a sequence
  2. CURRVAL gives the current value of a sequence
  3. CURRVAL can give duplicate values
  4. None of the above

16.Which of the following is used by an index to locate the data quickly?
  1. ROWNUM
  2. ROWID
  3. Sequence
  4. None of the above

17.What happens when there is no index on a column of a table?
  1. The data is located quickly
  2. There is a full table scan
  3. The table cannot be created
  4. The table cannot be altered




Want to Learn Database Programming?

Comments

Popular posts from this blog

How E-commerce Sites can Increase Sales with Pinterest?

Every thing U can do with a Link-List + Programming_it_in_JaVa

Test Your SQL Basics - Part_1