0% found this document useful (0 votes)
178 views

Topic: Data Types: (Default Is 1)

This document contains multiple choice questions about various Oracle database concepts including data types, data retrieval and manipulation. Some key points covered include: - The LONG data type cannot be returned from a stored function. - Tables can contain columns of various data types including BOOLEAN, DATE, NUMBER, VARCHAR2, CLOB, BLOB, BFILE and others. - Functions like MAX, MIN, COUNT, SUM, AVG can be used with aggregate functions and grouping. - Joins, filters, conversions, NULL handling, and other SQL clauses and operations are discussed.

Uploaded by

vignesh waran
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
178 views

Topic: Data Types: (Default Is 1)

This document contains multiple choice questions about various Oracle database concepts including data types, data retrieval and manipulation. Some key points covered include: - The LONG data type cannot be returned from a stored function. - Tables can contain columns of various data types including BOOLEAN, DATE, NUMBER, VARCHAR2, CLOB, BLOB, BFILE and others. - Functions like MAX, MIN, COUNT, SUM, AVG can be used with aggregate functions and grouping. - Joins, filters, conversions, NULL handling, and other SQL clauses and operations are discussed.

Uploaded by

vignesh waran
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 16

Topic: Data Types

Which of the following is not true regarding LONG values?


a) A table can contain only one LONG column
b) LONG columns can appear in where clauses
c) Stored function cannot return a LONG value
d) LONG columns cannot be indexed
Topic: Data Types
A table can have column of boolean data type.
a) TRUE
b) FALSE
Topic: Data Types
Oracle Table can have a boolean data type for its column(s)?
a) TRUE
b) FALSE
Topic: Data Types
A long column can store data upto
a) 2 Megabytes
b) 2 Gigabytes
c) 2000 bytes
d) None of the above
Topic: Data Types
BFILE data type can store upto a maximum of
a) 1 GB
b) 2 GB
c) 4 GB
d) None of the above
Topic: Data Types
Create table tab_name(col1 long, col2 long); The above statement will create a table tab_name
a) TRUE
b) FALSE (only one long col can be there)
Topic: Data Types
CREATE TABLE table_name(column_name CHAR); What will be the length of the column column_name in the table table_name
a) 1 (default is 1)
b) 2
c) 10
d) 2000
Topic: Data Types
Which all are DATETIME data types that can be used when specifying column definitions?
a) TIMESTAMP
b) INTERVAL MONTH TO DAY
c) DATE
d) A & C
Topic: Data Types
CREATE TABLE table_name(column_name CHAR);
The above SQL statement will throw an error as length for CHAR data type is not specified
a) TRUE
b) FALSE
Topic: Data Types
Which of the following is not a valid data type in Oracle 10g?
a) DATE
b) TIMESTAMP(3)
c) TIMESTAMP(6)
d) TIME
Topic: Data Types
What is the maximum length of a CHAR data type
a) 2000
b) 4000
c) 8000
d) No limit
Topic: Data Types
Assume we want to store patient's image onto the hospital database while creating the patient table which of the following
data types should be used for storing image within the database.
a) CLOB
b) BFILE – store a link to an external binary file (file stored outside of the database)
c) BLOB
d) NCLOB
Topic: Data Types
Which of the following is a not Unicode-only datatype?
a) CHAR
b) NCHAR
c) NVARCHAR2
d) All of the above
Topic: Data Types
How many columns are allowed in Oracle10g table?
a) 255
b) 10000
c) 1000
d) there is no limit (infinite)
Topic: Data Types
What is the maximum length we can give to VARCHAR2( )?
a) 2000
b) 4000
c) 1000
d) there is no limit (infinite)
Topic: Data Types
Which data type(s) can hold a null value?
a) VARCHAR2( )
b) NUMBER( )
c) DATE
d) All of the above
Topic: Data Types
Which of the following is a Unicode-only datatype?
a) Char
b) NCHAR
c) VARCHAR2
d) None
Topic: Data Types
What would be the value stored in database, if 123.89 is stored in a column of datatype NUMBER(6,-2)?
-2 means round to hundreds
a) 123
b) 100
c) 120
d) 123.9
Topic: Data Types
Which of the following datatype is stored as an external file on the server?
a) BLOB
b) NCLOB
c) CLOB
d) BFILE
Topic: Data Types
Which of the following SQL functions can operate on any datatype?
a) MAX
b) LOWER
c) LPAD
d) ADD_MONTHS
Topic: Data Types
Which of the following can be stored in a NUMBER(8,2) datatype?
a) 999999.99
b) 999999.999
c) 9999999.99
d) 99999.999
Topic: Data Types
Which of the following datatypes cannot be used with any of the built-in functions?
a) NUMBER
b) LONG RAW
c) VARCHAR2
d) BOOLEAN
Topic: Data Types
Which datatype can be used for loop counters?
a) LONG
b) FLOAT
c) PLS_INTEGER
d) ROWID
Topic: Data Types
Which datatype is used to store unstructured binary data outside the database?
a) BLOB
b) CLOB
c) NCLOB
d) BFILE
Topic: Data Types
Which of the following SQL functions is used to convert a string from one CHARACTERSET to another?
a) CAST
b) CONVERT
c) TO_CHAR
d) REPLACE
Topic: Data Types
Which of the following is a pseudocolumn?
a) ROWID ( SYSDATE, SYSTIMESTAMP,ROWID, ROWNUM, UID, USER, LEVEL, CURRVAL, NEXTVAL, ORA_ROWSCN, etc.)
b) NUMBER
c) CHAR
d) VARCHAR2
Topic: Data Retrieval Manipulation
What is the output for the following query?
select NULL + 5 from dual ;
a) NULL ("Any arithmetic expression containing a null always evaluates to null.")
b) 5
c) Will give an Error
d) 0
Topic: Data Retrieval Manipulation
What is the output for the following query?
Select round(15.193,-1) from dual;
a) 20
b) 10
c) 15.2
d) 15
Topic: Data Retrieval Manipulation
Which of the following will slow down the query most:-
a) name=Ram
b) name like Ram%
c) name like %Ram%
d) None of the above
Topic: Data Retrieval Manipulation
What is the output for the following query?
select NULL||'ORACLE L.1.1' from dual ;
a) NULL
b) ORACLE L.1.1
c) A and B
d) None of the above
Topic: Data Retrieval Manipulation
In SQL string length constraints for VARCHAR2 must be in range
a) 1 .. 2000
b) 1 .. 4000
c) 1 .. 32767
d) None of the above
Topic: Data Retrieval Manipulation
select name from salesreps where sales between 1000 and 2000;
a) Query will display the name from the salesreps table whose sales is >1000 and sales < 2000
b) Query will display the name from the salesreps table whose sales is >=1000 and sales <= 2000
c) Query will display the name from the salesreps table whose sales is >=1000 and sales < 2000
d) Query will display the name from the salesreps table whose sales is >1000 and sales <= 2000
Topic: Data Retrieval Manipulation
Table A has 120 rows ; Table B has no rows .
How many rows will be returned by the following SQL statement
SELECT * FROM A,B;
a) 0
b) 120
c) 121
d) None of the above
Topic: Data Retrieval Manipulation
Distinguish between case and decode
a) case can be used wherever decode is used
b) decode can be used wherever case is used
c) In "case" we can only use equal operation and in "decode" we can use all relational opeations
d) none of the above
Topic: Data Retrieval Manipulation
If a table (table_name) contains the values 10,20,30,null,null for a column col1,What will the output of the below select
statement.
Select count(col1) from table_name;
a) 3
b) 5
c) 2
d) None
Topic: Data Retrieval Manipulation
When does a foreign key constraint enforce domain integrity?
a) During inserts
b) During select
c) During optimization
d) During create
Topic: Data Retrieval Manipulation
Which of the following query will print Even number of records ?
a) select * from emp where (rowid,1)
b) select * from emp where (rowid,1) in (select rowid, mod(rownum,2) from emp)
c) select * from emp where (rowid,0) in (select rowid, mod(rownum,2) from emp)
d) select * from emp where (rowid,0)
Topic: Data Retrieval Manipulation
In NVL2(expr1,expr2,expr3), if expr1 is not null, then NVL2 returns
a) expr1
b) expr2
c) expr3
d) null
Topic: Data Retrieval Manipulation
The EMP table contains these columns:
LAST NAME VARCHAR2(25)
SALARY NUMBER(6,2)
DEPARTMENT_ID NUMBER(6)
You need to display the employees who have not been assigned to any department.
You write the SELECT statement:
SELECT LAST_NAME, SALARY, DEPARTMENT_ID
FROM EMP
WHERE DEPARTMENT_ID = NULL;
What is true about this SQL statement?
a) The SQL statement displays the desired results.
b) The column in the WHERE clause should be changed to display the desired results.
c) The operator in the WHERE clause should be changed to display the desired results.
d) The WHERE clause should be changed to use an outer join to display the desired results.
Topic: Data Retrieval Manipulation
What is true about ORDER BY clause?
a) Can appear only at the very end of the statement
b) Will accept the column name, aliases from the first SELECT statement
c) Will accept the positional notation
d) All of the above
Topic: Data Retrieval Manipulation
Group functions ignore null values.
a) TRUE
b) FALSE
Topic: Data Retrieval Manipulation
select 1,5 from dual
intersect
select 1,5 from dual;
What will be the output of the above statement?
a) 1 5
b) null null
c) 0 0
d) None of the above
Topic: Data Retrieval Manipulation
What is the output of the below sql statement
select * from dual;
a) NULL
b) SYSDATE
c) 'X'
d) Number of Tables
Topic: Data Retrieval Manipulation
Which are true about aggregate functions?
a) You can use aggregate functions in any clause of a SELECT statement.
b) You can use aggregate functions only in the column list of the SELECT clause and in the WHERE clause of a SELECT
statement.
c) You can mix single row columns with aggregate functions in the column list of a SELECT statement by grouping on the single
row columns.
d) You can use aggregate functions on a table, only by grouping the whole table as one single group.
Topic: Data Retrieval Manipulation
Examine the following statements.
Insert into tableXYZ values (1, 2, 3);
Create table ABC (sno CHAR(1));
Rollback;
What happens to the row inserted into tableXYZ?
a) Record available in the table
b) Record not available in the table
c) Record available in table with inconsistent state
d) none of the above
Topic: Data Retrieval Manipulation
1 select 1 from dual
2 minus
3 select 'a' from dual ;
The above statement will through error on line
a) 1
b) 2
c) 3
d) None of the above
Topic: Data Retrieval Manipulation
Which SQL function can be used instead of the IF construct?
a) Coalesce
b) Decode
c) Nullif
d) B and C
Topic: Data Retrieval Manipulation
Which of the following is multiple-row comparison operator?
a) IN
b) ANY
c) ALL
d) All of the above
Topic: Data Retrieval Manipulation
select 1,5 from dual
minus
select 1,5 from dual;
What will be the output of the above statement
a) 0 0
b) null null
c) No rows selected
d) None of the above
Topic: Data Retrieval Manipulation
Evaluate the SQL statement:
SELECT ROUND(45.953, -1), TRUNC(45.936, 2) FROM Dual;
Which values are displayed?
a) 46 and 45
b) 46 and 45.93
c) 50 and 45.93
d) 45 and 45.93
Topic: Data Retrieval Manipulation
The maximum number of components in the DECODE function, including expr,searches, results, and default, is
a) 265
b) 250
c) 255
d) 275
Topic: Data Retrieval Manipulation
Which clause appears only in the last component of a query?
a) WHERE
b) GROUP BY
c) ORDER BY
d) HAVING
Topic: Data Retrieval Manipulation
What is the output of SIGN(a) function? If a is less than '0'.
a) 1
b) -1
c) 0
d) 2.414
Topic: Data Retrieval Manipulation
Examine the structure of the EMPLOYEES table:
EMPLOYEE_ID NUMBER Primary Key
FIRST_NAME VARCHAR2(25)
LAST_NAME VARCHAR2(25)
Which statement inserts a row into the table?
a) INSERT INTO employees (employee_id, first_name, last_name) VALUES ( 1000, 'John',' ');
b) INSERT INTO employees( first_name, last_name)VALUES(John,Smith);
c) INSERT INTO employees( first_name, last_name, employee_id) VALUES ( 1000, John, Smith);
d) INSERT INTO employees VALUES ( NULL, John,Smith);
Topic: Data Retrieval Manipulation
What DML operations can perform using Merge Statement
a) Insert
b) Update
c) a & b also delete
d) None of the above
Topic: Data Retrieval Manipulation
which of the following is data query language?
a) INSERT
b) UPDATE
c) SELECT
d) All the above
Topic: Data Retrieval Manipulation
Which of the following statement is true regarding ORDER BY clause?
a) The sort is in ascending order by default.
b) The sort is in descending order by default.
c) The ORDER BY clause must precede the WHERE clause.
d) The ORDER BY clause is executed on the client side.
Topic: Data Retrieval Manipulation
Which is character manipulation function?
a) TRIM
b) TRUNC
c) TO_DATE
d) CASE
Topic: Data Retrieval Manipulation
which one of following commands does not belongs to DML?
a) truncate
b) delete
c) update
d) merge
Topic: Data Retrieval Manipulation
Which SQL statement returns a numeric value?
a) SELECT ADD_MONTHS(MAX(hire_Date), 6) FROM EMP;
b) SELECT ROUND(hire_date) FROM EMP;
c) SELECT sysdate-hire_date FROM EMP;
d) SELECT TO_NUMBER(hire_date + 7) FROM EMP;
Topic: Data Retrieval Manipulation
Evaluate the SQL statement:
SELECT ROUND(TRUNC(MOD(1600,10),-1),2)FROM dual;
What will be displayed?
a) 0
b) 1
c) 2
d) An error statement
Topic: Data Retrieval Manipulation
What would be the output of the below query?
select decode(substr('TECHNOLOGY',2,3),'CH','PASS','FAIL') from dual;
a) PASS
b) FAIL
c) No output
d) Error
Topic: Data Retrieval Manipulation
If a table (table_name) contains the values 10,20,30,null,null for a column col1,What will the output of the below select
statement.
Select count(*) from table_name;
a) 5
b) 3
c) 2
d) None
Topic: Data Retrieval Manipulation
Certain DML privileges are required for merge statement.Which of the following is true?
INSERT and UPDATE object privileges on the target table and the SELECT object privilege on the source table
INSERT,DELETE and UPDATE object privileges on the target table and the SELECT object privilege on the source table
SELECT,INSERT and UPDATE object privileges on the target table and the SELECT object privilege on the source table
SELECT,INSERT and UPDATE object privileges on the target table and the SELECT,UPDATE object privilege on the source table
Topic: Data Retrieval Manipulation
Which operator is used to return all distinct rows that are selected by the first query but not by the second?
a) MINUS
b) intersect
c) union
d) None of the above
Topic: Data Retrieval Manipulation
Which operator is used to comment a single line within the query?
a) %%
b) --
c) $$
d) COMMENT
Topic: Data Retrieval Manipulation
Which SELECT statement displays 2000 in the format “$2,000.00??
a) SELECT TO CNAR(2000, ‘$9,999.00’) FROM dual;
b) SELECT TO CNAR(2000, ‘$#,###.##’) FROM dual;
c) SELECT TO CNAR(2000, ‘$2,000.00’) FROM dual;
d) SELECT TO CNAR(2000, ‘$N,NNN.NN’) FROM dual;
Topic: Data Retrieval Manipulation
Which of the following is the right statement to get maximum salary from employees table?
a) SELECT MAX(salary) FROM employees;
b) SELECT salary FROM employees;
c) SELECT salary (MAX) "Maximum" FROM employees;
d) SELECT salary "Maximum" FROM employees;
Topic: Data Retrieval Manipulation
Unique Constraint violation error occurs during ?
a) INSERTS
b) SELECT
c) DELETE
d) All of the above
Topic: Data Retrieval Manipulation
Which of the following syntax enables an existing constraint ?
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;
Topic: Data Retrieval Manipulation
State TRUE or FALSE:
Oracle SQL Function "MOD(n2,n1)" returns the remainder of n2 divided by n1
a) TRUE
b) FALSE
Topic: Data Retrieval Manipulation
Oracle Server implicitly creates a unique index for ?
a) NOT NULL & PRIMARY KEY
b) PRIMARY KEY & FOREIGN KEY
c) CHECK & UNIQUE
d) UNIQUE & PRIMARY KEY
Topic: Data Retrieval Manipulation
Which of the following SELECT statement will display the result 'World' from the string 'Hello World'?
a) SELECT SUBSTR( 'Hello World',7) FROM DUAL;
b) SELECT LEFT('Hello World',5) FROM DUAL;
c) SELECT RIGHT('Hello World',5) FROM DUAL;
d) All of the above
Topic: Data Retrieval Manipulation
SELECT * FROM employees
WHERE hire_date < TO_DATE ('01-JAN-1999', 'DD-MON-YYYY') AND salary > 3500;
The above SQL statement retrieves ?
a) Only those hired before 1999 and earning less than $3500 a month are returned
b) Only those hired after 1999 and earning more than $3500 a month are returned
c) Only those hired after 1999 and earning more than $3500 a month are returned
d) Only those hired before 1999 and earning more than $3500 a month are returned
Topic: Data Retrieval Manipulation
Which of the following SQL statements can calculate and return the absolute value
of -33?
a) SELECT ABS("-33") Absolute FROM DUAL;
b) SELECT ABS('-33') "Absolute" FROM DUAL;
c) SELECT ABS(-33) "Absolute" FROM DUAL;
d) None of the above
Topic: Data Retrieval Manipulation
Which of the following SQL statement will display system date in the format "Monday, 01 June, 2001" ?
a) SELECT TO_DATE (SYSDATE, 'FMDAY, DD Month, YYYY') FROM dual;
b) SELECT TO_CHAR (SYSDATE, 'FMDD, DY Month, YYYY') FROM dual;
c) SELECT TO_CHAR (SYSDATE, 'FMDY, DDD Month, YYYY') FROM dual;
d) SELECT TO_CHAR (SYSDATE, 'FMDay, DD Month, YYYY') FROM dual;
Topic: Data Retrieval Manipulation
Which SQL statement would you use to remove a view called EMP_DEPT_VU from your schema?
a) DELETE VIEW emp_dept_vu;
b) DROP VIEW emp_dept_vu;
c) DROP emp_dept_vu;
d) DELETE emp_dept_vu;
Topic: Data Retrieval Manipulation
Which SELECT statement should you use to extract the year from the system date and display it in the format "1998"?
a) SELECT TO_DATE(SYSDATE, 'yyyy') FROM dual;
b) SELECT TO_CHAR(SYSDATE, 'yyyy') FROM dual;
c) SELECT DECODE(SUBSTR(SYSDATE, 8), 'YYYY') FROM dual;
d) SELECT DECODE(SUBSTR(SYSDATE, 8), 'year') FROM dual;
Topic: Data Retrieval Manipulation
Evaluate this SQL statement:
SELECT ename, sal FROM EMP;
The SAL column stores the monthly salary of the employee. Which of the following query calculates the annual compensation
as "monthly salary plus a monthly bonus of $100, multiplied by 12"?
a) SELECT ename, sal, (12*sal)+100 FROM emp;
b) SELECT ename, sal+(100*12) FROM emp;
c) SELECT ename, sal, 12*(sal+100) FROM emp;
d) None of the above
Topic: Data Retrieval Manipulation
Which of the following transaction control statement prevents more than one user from updating data in a table ?
a) LOCK
b) COMMIT
c) ROLLBACK
d) SAVEPOINT
Topic: Data Retrieval Manipulation
You are granted the CREATE VIEW privilege. What does this privilege allow you to do?
a) Create a table view
b) Create a view in ANY schema
c) Create a view in your schema (Create any view, drop any view only)
d) Create a view only of it is based on tables that you created.
Topic: Data Retrieval Manipulation
An inline view is a SELECT statement that is given an alias and is embedded in the _______________ clause of another SELECT
statement.
a) FROM
b) WHERE
c) SELECT
d) CASE
Topic: Data Retrieval Manipulation
Which SELECT statement will display the next value of the PARTS_ID_SEQ sequence by
actually retrieving the value from the sequence?
a) SELECT NEXTVAL(parts_id_seq) FROM DUAL;
b) SELECT parts_id_seq.NEXTVAL FROM inventory;
c) SELECT parts_id_seq.NEXTVAL FROM DUAL;
d) SELECT NEXTVAL(parts_id_seq) FROM inventory;
Topic: Data Retrieval Manipulation
The EMP table contains these columns:
EMPLOYEE_ID NUMBER(4)
LAST_NAME VARCHAR2 (25)
JOB_ID VARCHAR2(10)
You want to search for strings that contain 'SA' in the JOB_ID column. Which SQL statement do you use?
a) SELECT employee_id, last_name, job_id FROM EMP WHERE job_id LIKE '%SA%';
b) SELECT employee_id, last_name, job_id FROM EMP WHERE job_id LIKE '%SA';
c) SELECT employee_id, last_name, job_id FROM EMP WHERE job_id LIKE 'SA%';
d) None of the above
Topic: Data Retrieval Manipulation
Which of the following Oracle Function retrieves maximum salary from EMP table ?
a) MAX
b) MIN
c) AVG
d) None of the above
Topic: Data Retrieval Manipulation
Which of the following Oracle Function retrieves average salary from EMP table ?
a) MAX
b) MIN
c) AVG
d) None of the above
Topic: Data Retrieval Manipulation
Which of the following UPDATE statement is TRUE
a) UPDATE emp SET empno=12 , empname = 'JOHN' WHERE empno=1;
b) UPDATE SET empno=12 , EMPNAME = 'JOHN' ON emp WHERE EMPNO=1;
c) UPDATE SET empno=12 , EMPNAME = 'JOHN' FROM emp WHERE EMPNO=1
d) None of the above
Topic: Data Retrieval Manipulation
Which of the following operation will not make an entry in the log file
a) TRUNCATE
b) DELETE
c) INSERT
d) UPDATE
Topic: Data Retrieval Manipulation
Which command is used to delete the table information from RECYCLEBIN
a) Drop table from recyclebin
b) Purge recyclebin
c) Delete recyclebin
d) None of the above
Topic: Data Retrieval Manipulation
Space is allocated to temporary table during _________________
a) Creation of temp table
b) First DML operation
c) Compilation of table
d) Data Dictionary updation.
Topic: Data Retrieval Manipulation
Which of the following clause allows Oracle to perform similar operations on dependant objects of a table
a) ALL
b) CACHE
c) CASCADE
d) COALESCE
Topic: Data Retrieval Manipulation
which of the following statement will help to delete the child record when a parent is getting deleted.
a) ALTER TABLE DEPT ADD FOREIGN KEY (empno) REFERENCES emp(empno) ON DELETE CASCADE;
b) ALTER TABLE DEPT ADD FOREIGN KEY (empno) REFERENCES emp(empno) ON DELETE ALL;
c) ALTER TABLE DEPT ADD FOREIGN KEY (empno) REFERENCES emp(empno) DELETE ALL;
d) ALTER TABLE DEPT ADD FOREIGN KEY (empno) REFERENCES emp(empno) AFTER DELETE CASCADE ;
Topic: Data Retrieval Manipulation
Which of the following is NOT TRUE about the PURGE clause in delete statement
a) Deletes the data from child tables
b) Drops the table and releases the space associated with it in a single step
c) Database does not place the table and its dependent objects into the recycle bin
d) All the above
Topic: Data Retrieval Manipulation
In a SELECT statement that includes a WHERE clause, where is the GROUP BY clause placed in the SELECT statement?
a) Immediately after the SELECT clause
b) Before the WHERE clause
c) After the WHERE clause
d) After the ORDER BY clause
Topic: Joins and Subqueries
The result of a ------------- for tables A and B always contains all records of the "left" table (A), even if the join-condition does not
find any matching record in the "right" table (B).
a) left outer join
b) RIGHT OUTER JOIN
c) FULL OUTER JOIN
d) None of the above
Topic: Joins and Subqueries
A left outer join will return all the rows that an inner join returns plus one row for each of the other rows in the first table that
did not have a match in the second table
a) TRUE
b) FALSE
Topic: Joins and Subqueries
In which of the following join ,
Every record from the "right" table (B) will appear in the result set at least once with null values for non-matching from the
"left" table (A)
a) LEFT OUTER JOIN
b) RIGHT OUTER JOIN
c) FULL OUTER JOIN
d) Inner join
Topic: Joins and Subqueries
In ----------------- join predicate arises implicitly by comparing all columns in both tables that have the same column-name in the
joined tables.
a) Equi Join
b) Inner Join
c) Outer Join
d) Natural Join
Topic: Joins and Subqueries
Evaluate the following SQL statement:
SELECT e.EMPLOYEE_ID,e.LAST_NAME,e.DEPARTMENT_ID, d.DEPARTMENT_NAME
FROM EMP e, DEPARTMENT d
WHERE e.DEPARTMENT_ID = d.DEPARTMENT_ID;
In the statement, which capabilities of a SELECT statement are performed?
a) Selection, projection, join
b) Difference, projection, join
c) Selection, intersection, join
d) Difference, projection, product
Topic: Joins and Subqueries
An inner join essentially combines the records from two tables (A and B) based on a given join-predicate.
a) TRUE
b) FALSE
Topic: Joins and Subqueries
Which statement about subqueries is true?
a) A single row subquery can retrieve data from more than one table.
b) A single row subquery can retrieve data from only one table.
c) A single row single column subquery cannot be used in a condition where the LIKE operator is used for comparison.
d) None of the above
Topic: Joins and Subqueries
What is true about the following two sql statements?
SELECT last_name, salary , hire_date FROM EMPLOYEES ORDER BY salary DESC;
SELECT last_name, salary, hire_date FROM EMPLOYEES ORDER BY 2 DESC;
a) The two statements produce identical results.
b) The second statement returns a syntax error
c) There is no need to specify DESC because the results are sorted in descending order by default.
d) None of the above
Topic: Joins and Subqueries
A subquery in the FROM clause of a SELECT statement is called :
a) Nested subquery
b) Inline view
c) Correlated subquery
d) None
Topic: Joins and Subqueries
what is the difference between Inner and equi join
a) An inner join is a type of join where we use = and <> in the where condition joining the tables. In an equi join we join tables
with = operator only
b) An inner join is a type of join where we use =+ in the where condition joining the tables. In an equi join we join tables with +
= operator only
c) An equi join is a type of join where we use = and <> in the where condition joining the tables. In an inner join we join tables
with = operator only
d) inner join and equi join both are same
Topic: Joins and Subqueries
Which operator can be used with a multiple-row subquery?
a) <>
b) LIKE
c) BETWEEN
d) NOT IN
Topic: Joins and Subqueries
Table A has 5 rows and table B has 0 rows Cartesian join on A,B will have----rows.
a) 1
b) 0
c) 5
d) None of the above
Topic: Joins and Subqueries
Which clause on merge statement is used to specify the source of the data to be updated or inserted?
a) using
b) on
c) into
d) merge_update_clause
Topic: Joins and Subqueries
Consider the following query :
select e.name, d.depid
from emp e, dept d
where e.depid(+) = d.depid;
The above query indicates :
a) Right Outer Join
b) Left Outer Join
c) Natural Join
d) Invalid Query
Topic: Joins and Subqueries
Which of the following is true regarding subqueries?
a) No limit on subquery in WHERE clause and 256 level can be nested in FROM clause
b) No limit on subquery in FROM clause and 255 level can be nested in WHERE clause
c) No limit on subquery in WHERE clause and 255 levels can be nested in FROM clause
d) No limit on subquery in WHERE clause and 32 level can be nested in FROM clause
Topic: Joins and Subqueries
The SQL------------------- operator takes the results of two queries and returns only rows that appear in both result sets.
a) INTERSECT
b) UNION
c) EXCEPT
d) None of the above
Topic: Joins and Subqueries
What is wrong with the following query?
select col1, col2, col3
from TableA, TableB, TableC
where TableA.col1 = TableB.col1
group by col3
a) col1 is ambiguously named but is not properly prefixed in the select clause.
b) There is no order by clause.
c) Group by clauses are not permitted in a join.
d) Identically named columns in two separate tables are not permitted in a join clause.
Topic: Joins and Subqueries
In which case would you use a FULL OUTER JOIN?
a) Both tables have NULL values.
b) You want all unmatched data from one table.
c) You want all unmatched data from both tables.
d) One of the tables has more data than the other.
Topic: Joins and Subqueries
A subquery can be used to _________.
a) Sort data in a specific order
b) Convert data to a different format
c) Retrieve data based on an unknown condition
d) All of the above
Topic: Joins and Subqueries
select 1 ,2 from dual
union
select 1,2 from dual;
What will be the output of the above query
a) 1 2
b) 2 1
c) null null
d) Throws an error
Topic: Joins and Subqueries
1 select 'A','B' from dual
2 union
3 select 1,2 from dual ;
The above statement throws an error at line number ___?
a) error at line 1
b) error at line 2
c) error at line 3
d) None of the above
Topic: Joins and Subqueries
A full outer join combines the results of both left and right outer joins.
a) TRUE
b) FALSE
Topic: Joins and Subqueries
What are the different types of OUTER JOINS?
a) LEFT OUTER JOIN
b) RIGHT OUTER JOIN
c) FULL OUTER JOIN
d) All of the above
Topic: Joins and Subqueries
Which statements about subqueries are true?
a) A single row subquery can retrieve only one column and one row.
b) A single row subquery can retrieve only one row but many columns.
c) A multiple row multiple columns subquery can be compared by using the ">" operator.
d) A single row single column subquery can not use the IN operator.
Topic: Joins and Subqueries
The order in which the system joins tables changes the final result-set of the query.
a) TRUE
b) FALSE
Topic: Joins and Subqueries
select 1 ,2 from dual
union all
select 1,2 from dual;
How many rows will be selected by the above query?
a) 1
b) 2
c) 0
d) Throws an error
Topic: Joins and Subqueries
A join is a query that combines rows from two or more tables, views, or materialized views
a) TRUE
b) FALSE
Topic: Joins and Subqueries
A join is a query that combines rows from only one table
a) TRUE
b) FALSE
Topic: Joins and Subqueries
During Joins, if any two of these tables have a column name in common, then you must qualify all references to these columns
throughout the query with table names to avoid ambiguity
a) TRUE
b) FALSE
Topic: Joins and Subqueries
An equijoin is a join with a join condition containing an equality operator
a) TRUE
b) FALSE
Topic: Joins and Subqueries
An equijoin is a join with a join condition containing an inequality operator
a) TRUE
b) FALSE
Topic: Joins and Subqueries
A self join is a join of a table to itself
a) TRUE
b) FALSE
Topic: Joins and Subqueries
A self join is a join of two different tables
a) TRUE
b) FALSE
Topic: Joins and Subqueries
A cartesian product join is a join between two tables with no join condition
a) TRUE
b) FALSE
Topic: Joins and Subqueries
A cartesian product join is a join between two tables with atleast one join condition
a) TRUE
b) FALSE
Topic: Joins and Subqueries
An inner join is also called a simple join
a) TRUE
b) FALSE
Topic: Joins and Subqueries
A natural join is same as equi join
a) TRUE
b) FALSE
Topic: Joins and Subqueries
A natural join is NOT same as equi join
a) TRUE
b) FALSE
Topic: Joins and Subqueries
In Oracle, a sub query can be used to _________
a) Create groups of data
b) Sort data in a specific order
c) Convert data to a different format
d) Retrieve data based on an unknown condition
Topic: Joins and Subqueries
Full outer join can be achieved by using which of the following option?
a) Left Outer Join intersect Right Outer Join
b) Left Outer Join minus Right Outer Join
c) Left Outer Join union Right Outer Join
d) None of the above
Topic: Joins and Subqueries
Which of the below statement could be accurate in describing Cartesian product?
a) select * from a, b where 1=2;
b) select * from a, b;
c) Both A & B
d) None of the above
Topic: Joins and Subqueries
In Oracle, Table A has 5 rows and table B has 1 row.
How many rows will be returned by the below query?
Select * from A, B;
a) 1
b) 5
c) 6
d) None of the above
Topic: Joins and Subqueries
In Oracle, Table A has 2 rows and table B has 3 rows.
How many rows will be returned by the below query?
Select * from A, B;
a) 2
b) 3
c) 5
d) 6

You might also like