Ethics in international research: Scholarly integrity workshop - 2013
Workshop(Integrity Constraint)
-
Upload
siva-prakash -
Category
Documents
-
view
8 -
download
0
description
Transcript of Workshop(Integrity Constraint)
1) Updating a Primary key value will be allowed by Oracle when it has
Oracle workshop
By Krishna Reddy1) Updating a Primary key value will be allowed by Oracle when it has
dependent records.
A)True B)False C)None
2)The _________ allows for automatic make it null value of child record when
a parent record
is deleted.
A) Add constraint B)Drop Constraint C)On delete cascade D)None
3) Evaluate the SQL statement
DROP TABLE DEPT:
Which four statements are true of the SQL statement? (Choose four)
A. You cannot roll back this statement.
B. All pending transactions are committed.
C. All views based on the DEPT table are deleted.
D. All indexes based on the DEPT table are dropped.
E. All data in the table is deleted, and the table structure is also deleted.
F. All data in the table is deleted, but the structure of the table is retained.
G. All synonyms based on the DEPT table are deleted.
4) >create table emp (empno number constraint pk_eno primary key,
ename varchar2(20));
> create table incr (empno number constraint fk_eno references emp(empno),
Doi date,iamt number);
> insert into emp values(7902,'JAN');4> insert into incr values(7902,12-jan-11,200);
1 row created.
SQL> alter table emp rename column rename empno to emp_number;
SQL> rename emp to employee;5) 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 student_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 student _ id CONSTRAINT stud _ id _pk PRIMARY KEY;
E. ALTER TABLE students MODIFY CONSTRAINT stud _ id _pk
PRIMARY KEY (student _ id);
6) For which two constraints does the Oracle Server implicitly create a unique index? (Choose two.)
A. NOT NULL B. PRIMARY KEY C. FOREIGN KEY D. CHECK E. UNIQUE7) Which syntax turns an existing constraint on? A. ALTER TABLE table_name ENABLE constraint_name;
B.ALTER TABLE table_name STATUS = ENABLE CONSTRAINT constraint _
name;
C. ALTER TABLE table_name ENABLE CONSTRAINT constraint _ name;
D. ALTER TABLE table_name STATUS = ENABLE CONSTRAINT constraint _
name;
E. ALTER TABLE table_name TURN ON CONSTRAINT constraint _ name;
F. ALTER TABLE table_name TURN ON CONSTRAINT constraint _ name;
8) Which SQL statement defines the FOREIGN KEY constraint on the
DEPTNO column of the EMP table?
A.) CREATE TABLE EMP
(empno NUMBER(4),
ename VARCNAR2(35),
deptno NUMBER(7,2) NOT NULL
CONSTRAINT emp_deptno_fk FOREIGN KEY deptno REFERENCES dept deptno);
B) CREATE TABLE EMP
(empno NUMBER(4),
ename VARCNAR2(35),
deptno NUMBER(7,2)
CONSTRAINT emp_deptno_fk REFERENCES dept (deptno));
C) CREATE TABLE EMP
(empno NUMBER(4)
ename VARCHAR2(35),
deptno NUMBER(7,2) NOT NULL,
CONSTRAINT emp_deptno_fk REFERENCES dept (deptno) FOREIGN KEY (deptno));
D. CREATE TABLE EMP
(empno NUMBER(4),
ename VARCNAR2(35),
deptno NUMBER(7,2) FOREIGN KEY
CONSTRAINT emp deptno fk REFERENCES dept (deptno));
9) When disable the primary key respected index will_________ A) Removed B) Disable C) Inactive D)None
10) DEFAULT option can be defined at Table Level.A )TrueB)FalseC)None
11) You need to display employees who have not been assigned to any department.
You write the SELECT statement:
>select ename,sal,deptno from emp
where deptno =null;
a) The SQL statement display the desired result.
b) The column in the WHERE clause should be changed to display the desired result.
c) The operator in the WHERE clause should be changed to display the desired result.
d) The WHERE clause should be changed to use an outer join to display the desired result.
12)Which a valid table name?
A. EMP@_TAB B. EMP#_TAB C.$EMP_TAB D. EMP_DELETE
13) For which action can you use the TO_DATE function?
A. Convert any date literal to a date
B. Convert any numeric literal to a date
C. Convert any character literal to a date
D. Convert any date to a character literal
E. Format '10-JAN-99' to 'January 10 1999'
14) Examine the structure of the / table:
EMPLOYEE_ID NUMBER Primary Key
FIRST_NAME VARCHAR2(25)
LAST_NAME VARCHAR2(25)
HIRE_DATE DATE
Which INSERT statement is invalid?
A. INSERT INTO employees (employee_id, first_name, last_name, hire_date)
VALUES (1000, 'John', 'smith','01/01/01);
B. INSERT INTO employees(employee_id, first_name, last_name, hire_date)
VALUES (1000, 'John', 'smith','01 january 01');
C.INSERT INTO employees1 (employee_id, first_name, last_name, hire_date)
VALUES (1003, 'John', 'smith',to_date('01-01-01'))
D. INSERT INTO employees(employee_id, first_name, last_name, hire_date)
VALUES (1000, 'John', 'smith','01-Jan-01');
15) Examine the structure of the EMPLOYEES table:
EMPLOYEE_ID NUMBER Primary Key
FIRST_NAME VARCHAR2 (25)
LAST_NAME VARCHAR2 (25)
HIRE_DATE DATE
Which UPDATE statement is valid?
A. UPDATE employees
SET first_name = 'John'
SET last_name = 'Smith'
WHERE employee_id = 180;
B. UPDATE employees
SET first_name = 'John',
SET last_name = 'Smith'
WHERE employee_id = 180;
C. UPDATE employee
SET first_name = 'John'
AND last_name = 'Smith'
WHERE employee_id = 180;
D. UPDATE employee
SET first_name = 'John', last_name = 'Smith'
WHERE employee_id = 180;
16) From SQL*Plus, you issue this SELECT statement:
SELECT* FROM order;
You use this statement to retrieve data from a data table for __________. (Choose all that apply)
A. Updating B. Viewing C. Deleting D. Inserting E. Truncating
17) Which four statements correctly describe functions that are available in
SQL? (Choose four)
A. INSTR returns the numeric position of a named character.
B. NVL2 returns the first non-null expression in the expression
list.
C. TRUNCATE rounds the column, expression, or value to n
decimal places.
D. DECODE translates an expression after comparing it to each
search value.
E. TRIM trims the heading of trailing characters (or both) from a
character string.
F. NVL compares two expressions and returns null if they are
equal, or the first expression of they are not equal.
G. NULLIF compares twp expressions and returns null if they are
equal, or the first expression if they are not equal.
18)Evaluate the SQL statement:
SELECT LPAD (salary,10,*)
FROM EMP
WHERE EMP _ ID = 1001;
If the employee with the EMP_ID 1001 has a salary of 17000, what is displayed?
A. 17000.00 B. 17000***** C. ****170.00 D. **17000.00
E.None
19) Examine the structure of the EMPLOYEES and NEW_EMPLOYEES tables:
EMPLOYEES
EMPLOYEE_ID NUMBER Primary Key
FIRST_NAME VARCHAR2(25)
LAST_NAME VARCHAR2(25)
HIRE_DATE DATE
NEW_EMPLOYEES
EMPLOYEE_ID NUMBER Primary Key
NAME VARCHAR2 (60)
Which DELETE statement is valid?
A. DELETE FROM employees
WHERE employee_id = (SELECT employee_id FROM employees);
B. DELETE * FROM employees
WHERE employee_id = (SELECT employee_id FROM new_ employees);
C. DELETE FROM employees
WHERE employee_id IN (SELECT employee_id
FROM new_employees
WHERE name = 'carrey');
D. DELETE * FROM employees
WHERE employee_id IN (SELECT employee_id
FROM new_employees
WHERE name = 'carrey');
20) Select employee name whose job is Manager or Clerk and
Salary greater than 1000 and commission greater than 100 and deptno is
either 10 or 20.
A. select ename from emp
where job in('MANAGER','CLERK') AND SAL >1000 AND COMM>100
AND DEPTNO=(10,20);
B. Select ename from emp
where job in('MANAGER'OR 'CLERK') AND SAL >1000
AND COMM>100 AND DEPTNO IN(10,20);
C. Select ename from emp
where job in('MANAGER','CLERK')
AND SAL >1000 AND COMM>100
AND DEPTNO IN(10,20);
D. None
DURGA SOFTWARE SOLUTIONS, S.R.NAGAR, HYDERABAD-38. Cell: 9246212143