单项选择题You 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?()

A. ALTER TABLE students ADD PRIMARY KEY _ id;
B. ALTER TABLE students ADD CONSTRAINT PRIMARY KEY (student_id);
C. ALTER TABLE students ADD CONSTRAINT stud_id_pk PRIMARY KEY student_id;
D. ALTER TABLE students ADD CONSTRAINT stud_id_pk PRIMARY KEY (student_id);
E. ALTER TABLE students MODIFY CONSTRAINT stud_id_pk PRIMARY KEY (student_id);


您可能感兴趣的试卷

你可能感兴趣的试题

1.单项选择题You are the DBA for an academic database. You need to create a role that allows a group of users to modify existing rows in the STUDENT_GRADES table. Which set of statements accomplishes this? ()

A. CREATE ROLL registrar; GRANT MODIFY ON student_grant TO registrar; GRANT registrar to user 1, user2, user3
B. CREATE NEW ROLE registrar; GRANT ALL ON student_grant TO registrar; GRANT registrar to user 1, user2, user3
C. CREATE ROLL registrar; GRANT UPDATE ON student_grant TO registrar; GRANT ROLE to user1, user2, user3
D. CREATE ROLL registrar; GRANT UPDATE ON student_grant TO registrar; GRANT registrar to user 1, user2, user3;
E. CREATE registrar; GRANT CHANGE ON student_grant TO registrar; GRANT registrar;

2.单项选择题

Evaluate this SQL statement:
SELECT ename, sal, 12* sal+100 FROM emp;
The SAL column stores the monthly salary of the employee. Which change must be made to the above
syntax to calculate the annual compensation as "monthly salary plus a monthly bonus of $100, multiplied by 12"? ()

A. No change is required to achieve the desired results.
B. SELECT ename, sal, 12* (sal+100) FROM emp;
C. SELECT ename, sal, (12* sal)+100 FROM emp;
D. SELECT ename, sal +100,*12 FROM emp;

3.单项选择题Which statement adds a constraint that ensures the CUSTOMER_NAME column of the CUSTOMERS table holds a value?()

A. ALTER TABLE customers ADD CONSTRAINT cust_name_nn CHECK customer_name IS NOT NULL;
B. ALTER TABLE customers MODIFY CONSTRAINT cust_name_nn CHECK customer_name IS NOT NULL;
C. ALTER TABLE customers MODIFY customer_name CONSTRAINT cust_name_nn NOT NULL;
D. ALTER TABLE customers MODIFY customer_name CONSTRAINT cust_name_nn IS NOT NULL;
E. ALTER TABLE customers MODIFY name CONSTRAINT cust_name_nn NOT NULL;
F. ALTER TABLE customers ADD CONSTRAINT cust_name_nn CHECK customer_name NOT NULL;

4.单项选择题

Examine the description of the EMPLOYEES table:
EMP_ID NUMBER(4) NOT NULL
LAST_NAME VARCHAR2(30) NOT NULL
FIRST_NAME VARCHAR2(30)
DEPT_ID NUMBER(2)
Which statement produces the number of different departments that have employees with last name Smith? ()

A. SELECT COUNT (*) FROM employees WHERE last _name='smith';
B. SELECT COUNT (dept_id) FROM employees WHERE last _name='smith';
C. SELECT DISTINCT (COUNT (dept_id) FROM employees WHERE last _name='smith';
D. SELECT COUNT (DISTINCT dept_id) FROM employees WHERE last _name='smith';
E. SELECT UNIQE (dept_id) FROM employees WHERE last _name='smith';

5.单项选择题Which is an iSQL*Plus command? ()

A. INSERT
B. UPDATE
C. SELECT
D. DESCRIBE
E. DELETE
F. RENAME

6.单项选择题Which SQL statement would you use to remove a view called EMP_DEPT_VU from your schema?()

A. DROP emp_dept_uv;
B. DELETE emp_dept_uv;
C. REMOVE emp_dept_uv;
D. DROP VIEW emp_dept_uv;
E. DELETE VIEW emp_dept_uv;
F. REMOVE VIEW emp_dept_uv;

7.多项选择题Which four are valid Oracle constraint types? ()

A. CASCADE
B. UNIQUE
C. NONUNIQUE
D. CHECK
E. PRIMARY KEY
F. CONSTANT
G. NOT NULL

8.单项选择题

The EMPLOYEES table contains these columns:
EMPLOYEE_ID NUMBER(4)
ENAME VARCHAR2 (25)
JOB_ID VARCHAR2(10)
Which SQL statement will return the ENAME, length of the ENAME, and the numeric position of the
letter "a" in the ENAME column, for those employees whose ENAME ends with a the letter "n"?()

A. SELECT ENAME, LENGTH(ENAME), INSTR(ENAME, 'a') FROM EMPLOYEES WHERE SUBSTR (ENAME, -1,1) = 'n';
B. SELECT ENAME, LENGTH(ENAME), INSTR(ENAME, ,-1,1) FROM EMPLOYEES WHERE SUBSTR (ENAME, -1,1) = 'n';
C. SELECT ENAME, LENGTH(ENAME), SUBSTR(ENAME, -1,1) FROM EMPLOYEES WHERE INSTR (ENAME, 1,1) = 'n';
D. SELECT ENAME, LENGTH(ENAME), SUBSTR(ENAME, -1,1) FROM EMPLOYEES WHERE INSTR (ENAME, -1,1) = 'n';

9.单项选择题

You own a table called EMPLOYEES with this table structure: EMPLOYEE_ID NUMBER Primary Key
FIRST_NAME VARCHAR2(25)
LAST_NAME VARCHAR2(25)
HIRE_DATE DATE
What happens when you execute this DELETE statement? DELETE employees; ()

A. You get an error because of a primary key violation.
B. The data and structure of the EMPLOYEES table are deleted.
C. The data in the EMPLOYEES table is deleted but not the structure.
D. You get an error because the statement is not syntactically correct.

10.单项选择题

Examine the structure of the EMP_DEPT_VU view:
Column Name Type Remarks
EMPLOYEE_ID NUMBER From the EMPLOYEES table
EMP_NAME VARCHAR2(30) From the EMPLOYEES table JOB_ID VARCHAR2(20) From the EMPLOYEES table
SALARY NUMBER From the EMPLOYEES table
DEPARTMENT_ID NUMBER From the DEPARTMENTS table DEPT_NAME VARCHAR2(30) From the DEPARTMENTS table Which SQL statement produces an error?()

A. SELECT * FROM emp_dept_vu;
B. SELECT department_id, SUM(salary) FROM emp_dept_vu GROUP BY department _ id;
C. SELECT department_id, job_id, AVG(salary) FROM emp_dept_vu GROUP BY department _ id, job_id;
D. SELECT job_id, SUM(salary) FROM emp_dept_vu WHERE department_id IN (10,20) GROUP BY job_id HAVING SUM (salary) > 20000
E. None of the statements produce an error; all are valid.

最新试题

Which statement accomplish this? ()

题型:单项选择题

Examine the structure of the EMPLOYEES table: EMPLOYEE_ID NUMBER Primary KeyFIRST_NAME VARCHAR2(25)LAST_NAME VARCHAR2(25)HIRE_DATE DATEWhich INSERT statement is valid? ()

题型:单项选择题

You need to design a student registration database that contains several tables storing academic information.The STUDENTS table stores information about a student. The STUDENT_GRADES table storesinformation about the student's grades. Both of the tables have a column named STUDENT_ID. The STUDENT_ID column in the STUDENTS table is a primary key.You need to create a foreign key on the STUDENT_ID column of the STUDENT_GRADES table thatpoints to the STUDENT_ID column of the STUDENTS table. Which statement creates the foreign key?()

题型:单项选择题

Which view should a user query to display the columns associated with the constraints on a table owned by the user? ()

题型:单项选择题

Evaluate the SQL statement: TRUNCATE TABLE DEPT; Which three are true about the SQL statement? ()

题型:多项选择题

Examine the structure of the EMPLOYEES table:EMPLOYEE_ID NUMBER NOT NULL, Primary KeyEMP_NAME VARCHAR2(30)JOB_ID NUMBER\SAL NUMBERMGR_ID NUMBER References EMPLOYEE_ID columnDEPARTMENT_ID NUMBER Foreign key to DEPARTMENT_ID column of the DEPARTMENTS table You created a sequence called EMP_ID_SEQ inorderto populate sequential values for the EMPLOYEE_ID column of the EMPLOYEES table. Which two statements regarding the EMP_ID_SEQ sequence are true? ()

题型:多项选择题

User Mary has a view called EMP_DEPT_LOC_VU that was created based on the EMPLOYEES, DEPARTMENTS, and LOCATIONS tables. She has the privilege to create a public synonym, and would like to create a synonym for this view that can be used by all users of the database. Which SQL statement can Mary use to accomplish that task?()

题型:单项选择题

In which two cases would you use an outer join? ()

题型:多项选择题

Which constraint can be defined only at the column level? ()

题型:单项选择题

Evaluate this SQL statement:SELECT e.emp_name, d.dept_nameFROM employees eJOIN departments dUSING (department_id)WHERE d.department_id NOT IN (10,40)ORSER BY dept_name;The statement fails when executed. Which change fixes the error? ()

题型:单项选择题