SQL and Database Fundamentals
Covers SQL functions, queries, optimization, joins, constraints, views, triggers, and database keys with Oracle and general SQL examples
Questions
What is a candidate key?
- Used to uniquely identify a row
- Alias for primary key
- Used to identify a column
- Alias for foreign key
Can I call a trigger directly called from an application?
- True
- False
A view is nothing but a ________ table or a stored query
- Dymanic
- Real
- Virtual
- Static
How can we get the number of records or rows in a table?
- Using COUNT
- Using NUM
- Using NUMBER
- Both a and c above
An outer join requires each record in the two joined tables to have a matching record.
- True
- False
How do I find out all databases starting with ‘test to which I have access to?
- SHOW DATABASES LIKE ‘%tech%’;
- SHOW DATABASES LIKE ‘%tech;
- SHOW DATABASES LIKE ‘'tech'%’;
- SHOW DATABASES LIKE ‘tech%’;
Can I define multiple unique constraints on a table?
- True
- False
When do we use a HAVING clause?
- To limit the output of a query
- To limit the output of a query using an aggregate function only
- When GROUP by is used
- both b and c above
USE keyword is used to select a ___________ .
- Table
- Column
- Database
- All the above
Enum values are stored accodring to their index numbers?
- True
- False
The execution plan of the SQL statement is stored in
- A flat file called "plan_table.txt"
- Oracle Table called "plan_table"
- Oracle Table called "plan table"
- A flat file called "plan_table.tbl"
What is TRUE about driving table?
- It's advisable to choose the driving table with maximum number of records
- Number of records is NOT the criteria while selecting driving table
- It's advisable to choose the driving table with less number of records
- Driving table is always the last table accessed by the Optimizer
Why one should NOT use expressions on the columns in the predicate?
- Optimizer will return parse error if expressions are used on columns in the predicate
- Optimizer does not use index if expressions are used on the columns in the predicate, even if one exists
- It makes no difference with / without expressions on the columns in the predicate
- Using expressions on the columns in the predicate won't get benefits of using Table Alias
What will be the output of- "Select 1 from dual UNION Select 'A' from dual"
- 1,A
- A
- Error
- 1
A table has the following data: [[5, Null, 10]].What will the average function return ?
- Null
- 7.5
- 5
- 10
If all the values from a cursor have been fetched and another fetch is issued,what the output will be?
- Error
- Last record
- First record
- Can't be decided.
How many rows will the following SQL return : "Select * from emp Where rownum = 10" ?
- 10th row
- 1st row
- no rows returned
- First 10 rows
When a user creates an object without a TABLESPACE clause, where will Oracle store the segment?
- System tablespace
- Default tablespace for the user
- Users tablespace
- Oracle will give an error
Which of the following SQL functions can operate on any datatype?
- TO_CHAR
- LOWER
- MAX
- CEIL
- LPAD
Assuming today is Monday, 10 July 2000, what is returned by this statement: SELECT to_char(NEXT_DAY(sysdate, 'MONDAY'), 'DD-MON-RR') FROM dual?
- 10-JUL-00
- 12-JUL-00
- 11-JUL-00
- 14-JUL-00
- 17-JUL-00