SQL- Chapter 2

अब Quizwiz के साथ अपने होमवर्क और परीक्षाओं को एस करें!

11. The following SQL statements create a table with a column named A, then add a row to that table, then query the table: CREATE TABLE NUMBER_TEST (A NUMBER (5,3)) ; INSERT INTO NUMBER_TEST (A) VALUES (3.1415) ; SELECT A FROM NUMBER_TEST ; What is the displayed output of the SELECT statement? A. 3.1415 B. 3.142 C. 3.141 D. None of the above

B. 3.142

Create a Simple Table 4. Which of the following are valid CREATE TABLE statements? (Choose three.) A. CREATE TABLE $ORDERS (ID NUMBER, NAME VARCHAR2 (30)) ; B. CREATE TABLE CUSTOMER_HISTORY (ID NUMBER, NAME VARCHAR2 (30)) ; C. CREATE TABLE "BOAT INVENTORY" (ID NUMBER, NAME VARCHAR2 (30)) ; D. CREATE TABLE workSchedule (ID NUMBER, NAME VARCHAR2 (30)) ;

B. CREATE TABLE CUSTOMER_HISTORY (ID NUMBER, NAME VARCHAR2 (30)) ; C. CREATE TABLE "BOAT INVENTORY" (ID NUMBER, NAME VARCHAR2 (30)) ; D. CREATE TABLE workSchedule (ID NUMBER, NAME VARCHAR2 (30)) ;

Explain How Constraints Are Created at the Time of Table Creation 12. Which of the following SQL statements creates a table that will reject attempts to INSERT a row with NULL values entered into the POSITION_ID column? A. CREATE TABLE POSITIONS (POSITION_ID NUMBER (3) , CONSRAINT POSITION_CON UNIQUE (POSITION_ID)) ; B. CREATE TABLE POSITIONS (POSITION_ID NUMBER (3) , CONSTRAINT POSITION_CON PRIMARY KEY (POSITION_ID) ) ; C. CREATE TABLE POSITIONS (POSITION_ID NUMBER (3) , CONSTRAINT POSITION_CON REQUIRED (POSITION_ID) ); D. None of the above

B. CREATE TABLE POSITIONS (POSITION_ID NUMBER (3) , CONSTRAINT POSITION_CON PRIMARY KEY (POSITION_ID) ) ;

1. A table is which of the following? (Choose all that apply.) A. A schema object B. A nonschema object C. A role D. All of the above

A. A schema object

2. Which of the following are schema objects? (Choose all that apply.) A. SEQUENCE B. PASSWORD C. INDEX D. ROLE

A. SEQUENCE C. INDEX

Review the Table Structure 9. The DESC command can be used to do which of the following? A. Show a table's columns and the data types of those columns B. Show a brief paragraph describing what the table does C. Show a table's name and who created it D. Show the data that is contained within a table

A. Show a table's columns and the data types of those columns

3. A CONSTRAINT is assigned to which of the following? (Choose all that apply.) A. TABLE B. SYNONYM C. SEQUENCE D. INDEX

A. TABLE

5. Which of the following options can be used with the reserved word CREATE to form the beginning of a complete SQL statement? (Choose three.) A. TABLE B. VIEW C. CONSTRAINT D. SEQUENCE

A. TABLE B. VIEW D. SEQUENCE

14. Review the following SQL statement: CREATE TABLE personnel ( personnel_ID NUMBER (6), division_ID NUMBER (6), CONSTRAINT personnel_ID_PK PRIMARY KEY (personnel_ID) , CONSTRAINT division_ID_PK PRIMARY KEY (division_ID) ) ; Assume there is no table already called PERSONNEL in the database. What will be the result of an attempt to execute the preceding SQL statement? A. The statement will fail because you cannot create two primary key constraints on the table. B. The statement will successfully create the table and the first primary key but not the second. C. The statement will successfully create a single table and one composite primary key consisting of two columns. D. The statement will successfully create the table and two primary keys.

A. The statement will fail because you cannot create two primary key constraints on the table.

Drop Columns and Set Column UNUSED 15. The difference between dropping a column from a table with DROP and setting a column to be UNUSED is: A. An UNUSED column can be recovered. B. The UNUSED column and its data are retained within the table's storage allocation and counts against the total limit on the number of columns the table is allowed to have. C. A column that is dropped with DROP no longer appears within the table's description as shown with the DESC or DESCRIBE statement, whereas a column that is set to UNUSED still appears in the table's structure as shown in the output of the DESC statement. D. Nothing.

B. The UNUSED column and its data are retained within the table's storage allocation and counts against the total limit on the number of columns the table is allowed to have.

List the Data Types That Are Available for Columns 10. You attempt to execute the following SQL statement: CREATE TABLE VENDORS (VENDOR_ID NUMBER, VENDOR_NAME VARCHAR2, CATEGORY CHAR) ; Which one of the following is true? A. The execution fails because there is no precision indicated for NUMBER. B. The execution fails because there is no precision indicated for VARCHAR2. C. The execution fails because there is no precision indicated for CHAR. D. The execution succeeds, and the table is created.

B. The execution fails because there is no precision indicated for VARCHAR2.

7. You have a single database, with only one schema. The following four objects exist in the database: - A TABLE named PRODUCT_CATALOG - A TABLE named ADS - A USER named PRODUCT_CATALOG - A VIEW named CONFERENCE_SCHEDULE How many of the four objects are owned by the schema? A. 0 B. 2 C. 3 D. 4

C. 3

8. Which of the following is true about ROLES? A. Roles are schema objects but only when created from within a user account. B. Roles are in the same namespace as CONSTRAINTS. C. Roles are in the same namespace as TABLES. D. Roles are in the same namespace as USERS.

D. Roles are in the same namespace as USERS.

Create and Use External Tables 16. The purpose of the CREATE DIRECTORY statement is to create a named object in the database: A. That lists names of user accounts that have external privileges B. That contains lookup reference material for queries C. That identifies the root directory of the Oracle server installation D. That points to a directory you choose somewhere within the Oracle server's file system

D. That points to a directory you choose somewhere within the Oracle server's file system

13. Review the following SQL statement: CREATE TABLE SHIPPING_ ORDER ( order_ID NUMBER, order_Year CHAR (2) , customer_ID NUMBER, CONSTRAINT shipping_Order PRIMRY KEY (order_ID, order_Year) ) ; Assume there is no table already called SHIPPING_ORDER in the database. What will be the result of an attempt to execute the preceding SQL statement? A. The statement will fail because the data type for ORDER_YEAR is a CHAR, and CHAR data types aren't allowed in a PRIMARY KEY constraint. B. The statement will fail because there is no precision for the ORDER_ID column's data type. C. The table will be created, but the primary key constraint will not be created because the name does not include the _PK suffix. D. The statement will succeed: the table will be created, and the primary key will also be created.

D. The statement will succeed: the table will be created, and the primary key will also be created.

Create a Simple Table 6.. You are logged in to user FINANCE. It is currently the only schema in the entire database. The following exist in the database: - A VIEW named VENDORS - A CONSTRAINT named VENDORS - An INDEX named CUSTOMER#ADDRESS You attempt to execute the following SQL statement: CREATE TABLE CUSTOMER#ADDRESS (ID NUMBER, NAME VARCHAR2 (30)) ; Which one of the following is true? A. The question is flawed because you cannot have an INDEX named CUSTOMER#ADDRESS. B. The question is flawed because you cannot have a VIEW and a CONSTRAINT with identical names in the same schema. C. The SQL statement will fail to execute and result in an error message because you cannot create a TABLE name with the # character. D. The SQL statement will fail to execute and result in an error message because you cannot create a TABLE that has the same name as an INDEX in the same schema. E. The SQL statement will execute, and the TABLE will be created.

E. The SQL statement will execute, and the TABLE will be created.


संबंधित स्टडी सेट्स

AP Chemistry Test Thermodynamics multiple choice

View Set

Chapter 15: Communicable and Infectious Disease Risks

View Set

Chov zvířat a prostředí - skot

View Set

BA 101 - week 4 ch. 9 production & operations management e-textbook questions (i got wrong)

View Set

Personal Finance Planning Final Exam Ch 1-12

View Set

Chp. 10,11, and 12 of Crime Scene Two

View Set

AWS cloud practitioner exam practice

View Set