NEW
Font size
WorksheetsAssignment for MSE+CIE-2
Total questions: 20
Worksheet time: 19mins
1. Which of the following is not a built in aggregate function in SQL?
avg
max
total
count
Observe the given SQL query and choose the correct option.
SELECT branch_name, COUNT (DISTINCT customer_name) FROM depositor, account WHERE depositor.account_number = account.account_number GROUP BY branch_id
a) The query is syntactically correct but gives the wrong answer
b) The query is syntactically wrong
c) The query is syntactically correct and gives the correct answer
d) The query contains one or more wrongly named clauses.
State true or false: We can rename the resulting attribute after the aggregation function has been applied
true
false
none
What values does the count(*) function ignore?
a) Repetitive values
b) Null values
c) Characters
d) Integers
Which of the following is a good database management practice?
a) Adding redundant attributes
b) Not specifying primary keys
c) Removing redundant attributes
d) None of the mentioned
Which of the following command is used to obtain the structure of an Oracle table?
a) DESC TABLE [TableName].
b) STRUCTURE [TableName].
d) DESCRIBE STRUCTURE [TableName].
c) DESC [TableName].
What would be printed when the following code is executed?
DECLARE x NUMBER;
BEGIN
x := 5;
x := 10;
dbms_output.put_line(-x);
dbms_output.put_line(+x);
x := -10;
dbms_output.put_line(-x);
dbms_output.put_line(+x);
END;
-10
10
10
-10
-10
10
-10
10
10
10
-10
-10
-5
10
10
-10
10
Which of the following is true about the execution section of a PL/SQL block?
A - It is enclosed between the keywords BEGIN and END.
B - It is a mandatory section.
C - It consists of the executable PL/SQL statements.
D - All of the above
What does PL/SQL stand for?
PL/SQL stands for Procedural Language Extension of SQ
PL/SQL stands for Primary Language Extension of SQL
PL/SQL stands for Pattern Language Extension of SQL
PL/SQL stands for Private Language Extension of SQL
PL/SQL text is made up of lexical units, which are groups of characters and can be classified as –
Delimiters
Identifiers
Literals
All of the above
PL/SQL Variables are by default
Case Sensitive
Upper Case Sensitive
Lower Case Sensitive
Not Case Sensitive
An SQL ____ refers to a program that retrieves and processes one row at a time, based on the results of the SQL statement.
Cursor
Procedure
Function
View
The Implicit cursors are created in order to process the ____ statements.
DDL
DCL
TCL
DML
Which of the following is/are an/the implicit cursor's attribute(s)?
%FOUND
%ROWCOUNT
%ISOPEN
All of the above
The correct syntax to declare PL/SQL variable is –
variable_name [CONSTANT] datatype [NOT NULL] [:= | DEFAULT initial_value]
datatype [CONSTANT] variable_name [NOT NULL] [:= | DEFAULT initial_value]
variable_name [CONSTANT] datatype [NULL] [:= | DEFAULT initial_value]
datatype [CONSTANT] variable_name [NULL] [:= | DEFAULT initial_value]
What is a foreign key?
A foreign key is a primary key of a relation which is an attribute in another relation
A foreign key is a superkey of a relation which is an attribute in more than one other relations
A foreign key is an attribute of a relation that is a primary key of another relation
A foreign key is the primary key of a relation that does not occur anywhere else in the schema
What action does ⋈ operator perform in relational algebra
Output specified attributes from all rows of the input relation and remove duplicate tuples from the output
Outputs pairs of rows from the two input relations that have the same value on all attributes that have the same name
Output all pairs of rows from the two input relations (regardless of whether or not they have the same values on common attributes)
Return rows of the input relation that satisfy the predicate
Choose the option that correctly explains in words, the function of the following relational algebra expression
σyear≥2009 (book ⋈ borrow)
Selects all tuples from the Cartesian product of book and borrow
Selects all the tuples from the natural join of book and borrow wherever the year is lesser than 2009
Selects all the tuples from the natural join of book and student wherever the year is greater than or equal to 2009
Selects all tuples from the Cartesian product of book and borrow wherever the year is greater than or equal to 2009
Which of the following creates a virtual relation for storing the query?
Function
View
Procedure
None of the mentioned
CREATE VIEW faculty AS
SELECT ID, name, dept name
FROM instructor;
Find the error in this query.
Instructor
Select
View …as
None of the mentioned
