Font size
WorksheetsPQ Quiz 2
Total questions: 153
Worksheet time: 1hrs 17mins
A.... is a property of the entire relation, rather than
of the individual tuples in which each tuple is unique.
Rows
Key
Attribute
Fields
What is the result of the following query?
SELECT studentdatabasename
FROM RDBMS
WHERE marks > SOME (SELECT marks
FROM student
WHERE SECTION = 'c');
The query gives all the studentdatabasename for
which marks are greater than all the students in
section c
The query gives all the studentdatabasename for
which the marks are greater than at least on
student in section c
The query gives all the studentdatabasename for
which the marks are less than all the students in
section c
The query is syntactically incorrect
What is the correct answer to describe the following
query.
SELECT name
FROM instructor
WHERE salary IS NOT NULL;
Tuples with null value
Tuples with no null values
Tuples with any salary
All of the mentioned
Which of the following MySQL aggregate functions is used to calculate the average?
COUNT()
EVERAGE()
AVERAGE()
AVG()
From the query below, how many rows are selected?
SELECT Name
FROM instructor
WHERE salary > SOME (SELECT salary FROM
instructor WHERE dept_name = 'Comp.Sci.');
The number of rows selected depends on the data
in the 'instructor' table and the comparison of
salaries.
The number of rows selected is O
The number of rows selected is always 10
The number of rows selected is 100
The query given below will not give an error. Which one of the following has to be replaced to get the desired output?
SELECT ID, name, dept name, salary * 1.1
WHERE instructor;
Salary*1.1
ID
Where
Instructor
What is the purpose of the MySQL AUTO_INCREMENT attribute?
The purpose of the MySQL AUTO_INCREMENT
attribute is to delete existing rows in a table.
The purpose of the MySQL AUTO_INCREMENT
attribute is to update the values in a column.
The purpose of the MySQL AUTO_INCREMENT
attribute is to sort the rows in a table.
The purpose of the MySQL AUTO_INCREMENT
attribute is to automatically generate a unique
value for a column whenever a new row is inserted
into the table.
From the script,
CREATE TABLE department
(dept_name VARCHAR (20),
building VARCHAR (15),
budget NUMBER,
PRIMARY KEY (dept_name));
CREATE TABLE course
(course_id VARCHAR (7),
title VARCHAR (50),
dept_name VARCHAR (20),
credits NUMERIC (2,0),
PRIMARY KEY (course_id),
FOREIGN KEY (dept_name)
department);
CREATE TABLE instructor
(ID VARCHAR (5),
name VARCHAR (20) NOT NULL,
dept_name VARCHAR (20),
salary NUMERIC (8,2),
FOREIGN KEY (dept_name)
CREATE TABLE SECTION
(course_id VARCHAR (8),
sec_id VARCHAR (8),
semester VARCHAR (6),
YEAR NUMERIC (4,0),
building VARCHAR (15),
department);
room_number VARCHAR (7),
time_slot id VARCHAR (4),
PRIMARY KEY (ID, course_id, sec_id, semester, YEAR),
FOREIGN KEY (course_id, sec_id, semester, YEAR)
REFERENCES SECTION,
FOREIGN KEY (ID) _____instructor);
In order to include an attribute Name to the teaches
relation which of the following command is used?
Alter table teaches include Name;
Alter table teaches add Name;
Alter table teaches add Name varchar;
Alter table teaches add Name varchar(20);
Which of the following operations are associative
Natural joins
Theta joins
Both the mentioned
None of the mentioned
Choose the correct option regarding the query
SELECT branch_name, COUNT (DISTINCT
customer_name)
FROM depositor, account
WHERE depositor.account_number =
account.account_number
GROUP BY branch_id
HAVING avg(balance) = 10000;
The having clause allows only those tuples that
have an average balance of 10000
The having clause checks whether the query result
is true or not
The having clause does not check for any condition
None of the mentioned
A set of possible data values is called
A set of possible data values is called a 'range'.
A set of possible data values is called a 'variable'.
A set of possible data values is called a 'domain'.
A set of possible data values is called a 'coefficient'.
How does the GROUP BY clause work in the context of
SQL queries?
It is used to sort the result set in ascending order
It is used to filter the result set based on a specified
condition
It is used to group the result set based on one or
more columns
It is used to perform mathematical operations on
the result set
How does an attribute differ from an entity in a conceptual data model?
An attribute and an entity are the same thing in a
conceptual data model.
An attribute describes the properties or
characteristics of an entity, while an entity
represents a real-world object or concept.
An attribute is used to represent relationships
between entities, while an entity represents the
properties of an attribute.
An attribute is a type of entity, while an entity is a
type of attribute.
What is the first step in database normalization?
Test the database for errors
Gather and analyze the requirements of the
system
Implement the database system
Create the physical design of the database
What is the primary purpose of a foreign key in a relational database?
To create a logical structure that accurately
represents real-world entities and their
relationships.
To randomly group data without any logical
structure.
To confuse the database administrators.
To make the database more difficult to use.
What is the primary purpose of a relational database system?
To make the database more difficult to use
To randomly group data without any logical
structure
To create a logical structure that accurately
represents real-world entities and their
relationships.
To confuse the database administrators
The term attribute refers to a .......... of a table.
Record
Column
Tuple
Key
The ____ clause is used to list the attributes desired in the result of a query
select
from
where
create
Which of the following is a suitable entity?
Staff
StaffName
Blair Drive
P101
The values appearing in given attributes of any tuple in the referencing relation must likewise occur in specified attributes of at least one tuple in the referenced relation, according to. .... integrity constraint.
Referential
Primary
Referencing
Specific
If we specify multiple relations in the from clause and do not specify any conditions in the where clause, what will the result be?
Intersection of all the relations
Union of all the relations
Difference of all the relations
Cartesian product of all the relations
What is the significance of using foreign keys in a relational database system?
To ensure data integrity and enforce referential
integrity constraints
To create duplicate records in the database
To establish a direct connection between two
unrelated tables
To complicate the database structure
Which of the following is a good database management practice?
Adding redundant attributes
Not specifying primary keys
Removing redundant attributes
None of the mentioned
Interpret the relationship from Fighter to Fight Schedule shown in the conceptual data model
A Fighter MUST be assigned ONE or MORE Fight
Schedules
A Fighter MAY be assigned ONE or MORE Fight
Schedules
A Fighter MAY be assigned ONE and only ONE
Fight Schedule
A Fighter MUST be assigned ONE and only ONE
Fight Schedule
Which one of the following uniquely identifies the elements in the relation?
Primary key
Index key
Foreign key
Secondary key
What is the primary purpose of using SQL Views in a database system?
To complicate the database structure
To provide a logical representation of existing
tables or views
To store data separately from the main tables
To confuse the database administrators
What is the purpose of the following SQL command?
UPDATE table_name SET column_name = value
WHERE condition;
The command is used to insert new records into
the table 'table_name' where the condition is met.
The command is used to update records in the
table 'table_name' where the condition is met.
The command is used to delete records from the
table 'table_name' where the condition is met.
The command is used to retrieve records from the
table 'table_name' where the condition is met.
The ____ clause is used to list the attributes desired in the result of a query.
Where
Select
From
Distinct
What is the primary goal of using indexes in a database?
To make the database more difficult to use
To randomly group data without any logical
structure
To speed up data retrieval and improve query
performance
To confuse the database administrators
What is the purpose of a foreign key in a relational database?
A foreign key is used to uniquely identify a record
in a table.
A foreign key is used to establish a link between
two tables.
A foreign key is used to store duplicate records in a
table.
A foreign key is not necessary in a relational
database.
How does organizing supertypes and subtypes work
in the context of a relational database system?
By creating separate tables for each subtype
By using a technique called encapsulation
By ignoring the concept of supertypes and
subtypes
In a relational database system, organizing
supertypes and subtypes involves using a
technique called inheritance.
An attribute in a relation is a foreign key if the ------ key from one relation is used as an attribute in that relation.
Candidate
Primary
Super
Sub
What is the purpose of a foreign key in a relational database?
To uniquely identify each record in a table
To establish a link between two tables by
referencing the primary key of another table
To define the structure of the database
To perform complex calculations on the data
Consider a Grocery Store Sales System. Is the trend in sales considered Data or Information?
Graph
Information
Customer
Data
Which of the following employee_id will
be displayed for the given query?
SELECT * FROM employee WHERE
employee_id>1009;
1009, 1001, 1018
1009, 1018
1001
1018
To delete a database___command is used
Delete database database_name
Delete database_name
drop database database_name
drop database_name
From the script,
CREATE TABLE department
(dept_name VARCHAR (20),
building VARCHAR (15),
budget NUMBER,
PRIMARY KEY (dept_name));
CREATE TABLE course
(course_id VARCHAR (7),
title VARCHAR (50),
dept_name VARCHAR (20),
credits NUMERIC (2,0),
PRIMARY KEY (course_id),
FOREIGN KEY (dept_name)
department);
CREATE TABLE instructor
(ID VARCHAR (5),
name VARCHAR (20) NOT NULL,
dept_name VARCHAR (20),
salary NUMERIC (8,2),
FOREIGN KEY (dept_name)
CREATE TABLE SECTION
(course_id VARCHAR (8),
sec_id VARCHAR (8),
semester VARCHAR (6),
YEAR NUMERIC (4,0),
building VARCHAR (15),
department);
room_number VARCHAR (7),
time_slot id VARCHAR (4),
PRIMARY KEY (Course id sec id semster YEAR)
FOREIGN KEY (________)
CREATE TABLE teaches
(ID VARCHAR (5),
course_id VARCHAR (8),
sec_id VARCHAR (8),
semester VARCHAR (6),
YEAR NUMERIC (4,0),
PRIMARY KEY (ID, course_id, sec_id, semester, YEAR),
FOREIGN KEY (course_id, sec_id, semester, YEAR)
REFERENCES SECTION,
FOREIGN KEY (ID) ____
instructor);
In the course relation, the title field should throw an
error in case of any missing title. The command to be
added in title is
Unique
Not null
0
Null
What is the main purpose of the WHERE clause in SQL?
To filter rows based on specified conditions
To sort the result set in ascending order
To perform mathematical operations on the result
set
To join multiple tables together
In MySQL, which function is used to find the highest value in a column?
MINO
AVG()
COUNT()
MAX()
What does the SQL statement "SELECT DISTINCT" do?
The SQL statement 'SELECT DISTINCT' retrieves
values from multiple columns in a table.
The SQL statement 'SELECT DISTINCT' retrieves
values that are not unique from a specified column
in a table.
The SQL statement 'SELECT DISTINCT' retrieves all
values from a specified column in a table.
The SQL statement 'SELECT DISTINCT' retrieves
unique values from a specified column in a table.
What is the fundamental characteristic of data?
Subjectivity
Context-dependency
Organization
Rawness
What is the primary purpose of a primary key in a relational database?
To establish a link between two tables
To uniquely identify a record in a table
To store a unique identifier for a record
To perform mathematical operations on data
Which of the following information does an SQL DDL not specify?
Indexes for the tables
Actual data in the database
Constraints on the data
Data types for each column
What is the primary purpose of denormalizing a database?
To make the database more difficult to use
To randomly group data without any logical
structure
To create a logical structure that accurately
represents real-world entities and their
relationships.
To confuse the database administrators
The schema for the relationship set linking a weak entity set to its corresponding strong entity set is redundant.
True
False
Partially true
Not applicable
Which is a join condition contains an equality operator
GROUP BY clause
ORDER BY clause
Equijoins
Cartesian
An entity in A is associated with at most one entity in B. An entity in B, however, can be associated with any number (zero or more) of entities in A.
One-to-many
One-to-one
Many-to-many
Many-to-one
An attribute is a ........... in a relation.
Row
Column
Value
Tuple
A... ... ... on an attribute of a relation is a data structure
that allows the database system to find those tuples in
the relation that have a specified value for that
attribute efficiently, without scanning through all the
tuples of the relation.
Index
Reference
Assertion
Timestamp
Observe the following query and choose the correct
option.
select name, ID
from student natural join department natural join
section
The query is correct
The query is syntactically wrong because more
than one relations are included in the natural join
operation
The query is syntactically wrong because there are
more than one attributes in the select clause
The query is syntactically wrong because there is
no where clause
Which of the following is a suitable attribute?
Staff
StaffName
Blair Drive
P101
What is the fundamental characteristic of data?
Subjectivity
Context-dependency
Organization
Meaningfulness
What is the first step in conceptual database design methodology?
Test the database for errors
Gather and analyze the requirements of the
system
Implement the database system
Create the physical design of the database
Why the following statement is erroneous?
SELECT dept_name, ID, avg (salary)
FROM instructor
GROUP BY dept_name;
Dept ID should not be used in group by clause
Group by clause is not valid in this query
Avg(salary) should not be selected
None
Choose the correct command to delete an attribute A from a relation R
DELETE FROM R WHERE A = value;
ALTER TABLE R DROP COLUMN A;
UPDATE R SET A = NULL;
DROP A FROM R;
Department (dept name, building, budget) and
Employee (employee_id, name, dept name, salary)
Here the dept_name attribute appears in both the
relations. Here using common attributes in relation
schema is one way of relating. relations.
Attributes of common
Tuple of common
Tuple of distinct
Attributes of distinct
Which of the following keywords is used beside the
select clause to explicitly specify that duplicates are
not removed?
ALL
NOT UNIQUE
NOTNULL
INCLUDE
What does the following query do?
UPDATE student
SET marks = marks*1.10;
It decreases the marks of all the students by 90%
It increases the marks of all the students by 10%
It is syntactically wrong
It increases the marks of all the students by 110%
Which of the following information does the database
system catalog store?
Number of blocks
Size of a tuple of a relation
Number of tuples
All of the mentioned
SELECT * FROM customer WHERE age>25 AND
gender='Male';
Which of the following fields are displayed as output?
Age, gender
Customer
Age
All the fields of the customer relation
Which MySQL statement is used to add a new column
to an existing table?
INSERT COLUMN
UPDATE TABLE
ALTER TABLE
MODIFY TABLE
How does a relationship differ from an attribute in a
conceptual data model?
A relationship and an attribute are the same thing
in a conceptual data model.
A relationship represents the properties or
characteristics of an entity, while an attribute
represents the associations between different
entities or tables.
A relationship is used to represent the properties of
an attribute, while an attribute represents a real-
world object or concept.
A relationship is a type of attribute, while an
attribute is a type of relationship.
"Order By" clause is used to sort the result set of a
query based on specified columns.
True
False
Partially True
Partially False
Select the incorrect statement from the following.
Normalization is necessary because it ...
Reduces data redundancy
Prevent data inconsistencies
Increases data anomalies
Increases data integrity
Interpret the relationship from Fight Schedule to Fighter shown in the
conceptual data model
A Fight Schedule MAY be scheduled for ONE and
only ONE Fighter
A Fight Schedule MUST be scheduled for ONE and
only ONE Fighter
A Fight Schedule MUST be scheduled for ONE or
MORE Fighters
A Fight Schedule MAY be scheduled for ONE or
MORE Fighters
To replace the relation section with some other
relation the initial step to be carried out is
Delete section;
Drop section;
Delete from section;
Replace section new_table;
In the given query which of the keyword has to be
inserted?
INSERTINTO employee _____ (1002, Joey, 2000);
Table
Values
Relation
Field
The where clause is a predicate involving attributes of
the relation in the ......... clause.
select
from
with
none of the mentioned
create table apartment (ownerID varchar (5),
ownername varchar(25), floor numeric(4,0), primary
key (ownerID));
Choose the correct option regarding the above
statement.
The statement is syntactically wrong
It creates a relation with three attributes ownerID,
ownername, floor in which floor cannot be null
It creates a relation with three attributes ownerID,
ownername, floor in which ownerID cannot be null
It creates a relation with three attributes ownerID,
ownername, floor in which ownername must
consist of at least 25 characters
Which of the following is the correct output for the
given query?
(SELECT databaseid
FROM RDBMS
WHERE SECTION = 'c')
EXCEPT
(SELECT databaseid
FROM RDBMS
WHERE id < 10);
All the values of the databaseid for which section is
c and id > 10
All the values of the databaseid for which section
not c and id > 10
All the values of the databaseid for which section is
c and id < 10
All the values of the databaseid for which section
not c and id < 10
What is the primary purpose of denormalizing a database?
To make the database more difficult to use
To randomly group data without any logical
structure
To create a logical structure that accurately
represents real-world entities and their
relationships.
To confuse the database administrators
If RDBMS1, RDBMS2, RDBMS3 are attributes in a
relation and S is another relation, which of the
following is an incorrect specification of an integrity
constraint?
foreign key(RDBMS1, RDBMS2) references S
foreign key(RDBMS1, RDBMS2)
primary key(RDBMS1, RDBMS2, RDBMS3)
primary key(RDBMS1)
The function that an entity plays in a relationship is called that entity's..........
Participation
Position
Role
Instance
_____ joins are SQL server default
Outer
Inner
Equi
None of the Mentioned
If a1, a2, a3 are attributes in a relation and S is another
relation, which of the following is an incorrect
specification of an integrity constraint?
primary key(a1, a2, a3)
primary key(a1)
foreign key(a1, a2) references S
foreign key(a1, a2)
select distinct dept_name from institute;
What does the above query do?
It retrieves the total number of departments in the
'institute' table.
It retrieves a list of unique employee names from
the 'institute' table.
It retrieves a list of unique department names from
the 'institute' table.
It retrieves all department names from the
'institute' table.
Which command is used to create a new relation in SQL
CREATE TABLE
DELETE FROM
UPDATE
INSERT INTO
Relational Algebra is a ... ... ... query language that
takes two relations as input and produces another
relation as an output of the query.
Relational
Structural
Procedural
Fundamental
Phil is the database administrator for a Property
management company and creates a view named
PROPERTY_DISPLAY, which is based on the PROPERTY
table. Phil wants to make this view available for
querying to Mary. Which of the following actions
should Phil perform?
No action required. Because, by default, all
database users can automatically access views.
Phil must grant to Mary the SELECT privilege on
both the PROPERTY table and PROPERTY_DISPLAY
view.
Phil should assign the SELECT privilege to Mary for
the PROPERTY_DISPLAY view.
Phil should IT department to grant SELECT privilege
to Mary for the PROPERTY table.
From the script,
CREATE TABLE department
(dept_name VARCHAR (20),
building VARCHAR (15),
budget NUMBER,
PRIMARY KEY (dept_name));
CREATE TABLE course
(course_id VARCHAR (7),
title VARCHAR (50),
dept_name VARCHAR (20),
credits NUMERIC (2,0),
PRIMARY KEY (course_id),
FOREIGN KEY (dept_name)
department);
CREATE TABLE instructor
(ID VARCHAR (5),
name VARCHAR (20) NOT NULL,
dept_name VARCHAR (20),
salary NUMERIC (8,2),
FOREIGN KEY (dept_name)
CREATE TABLE SECTION
(course_id VARCHAR (8),
sec_id VARCHAR (8),
semester VARCHAR (6),
department);
YEAR NUMERIC (4,0),
building VARCHAR (15),
room_number VARCHAR (7),
time_slot id VARCHAR (4),
PRIMARY KEY (Course id sec id semster YEAR)
FOREIGN KEY (_______) ___ course);
CREATE TABLE teaches
(ID VARCHAR (5),
course_id VARCHAR (8),
sec_id VARCHAR (8),
semester VARCHAR (6),
YEAR NUMERIC (4,0),
PRIMARY KEY (ID, course_id, sec_id, semester, YEAR),
FOREIGN KEY (course_id, sec_id, semester, YEAR)
REFERENCES SECTION,
FOREIGN KEY (ID) ________ instructor);
The department relation has an entry budget, and the
type must be replaced by
Varchar (20)
Varchar2 (20)
Numeric (12,2)
Numeric
What is the fundamental characteristic of information in the context of data management?
Subjectivity
Context-dependency
Organization
Meaningfulness
In a relational database system, how
would you organize the Clothing, Shirt,
and Shoe supertypes and subtypes?
Combine Shirt and Shoe details in a single table
due to their similar characteristics.
Create separate tables for Shirt and Shoe subtypes
due to their distinct relationships and differing
attributes.
Develop one table for all Clothing, Shirt, and Shoe
details to streamline database management.
Employ a single table for Clothing and individual
tables for Shirt and Shoe based on their materials.
What is the fundamental characteristic of information?
Subjectivity
Context-dependency
Organization
Meaningfulness
SELECT item name, color, clothes SIZE, SUM(quantity)
FROM sales
GROUP BY rollup(item name, color, clothes SIZE);
How many grouping is possible in this rollup?
4
10
8
2
From the script,
CREATE TABLE department
(dept_name VARCHAR (20),
building VARCHAR (15),
budget NUMBER,
PRIMARY KEY (dept_name));
CREATE TABLE course
(course_id VARCHAR (7),
title VARCHAR (50),
dept_name VARCHAR (20),
credits NUMERIC (2,0),
PRIMARY KEY (course_id),
FOREIGN KEY (dept_name)
department);
CREATE TABLE instructor
(ID VARCHAR (5),
name VARCHAR (20) NOT NULL,
dept_name VARCHAR (20),
salary NUMERIC (8,2),
FOREIGN KEY (dept_name)
CREATE TABLE SECTION
(course_id VARCHAR (8),
sec_id VARCHAR (8),
semester VARCHAR (6),
YEAR NUMERIC (4,0),
building VARCHAR (15),
department);
room_number VARCHAR (7),
time_slot id VARCHAR (4),
PRIMARY KEY (Course id sec id semster YEAR)
FOREIGN KEY (________) _____course);
CREATE TABLE teaches
(ID VARCHAR (5),
course_id VARCHAR (8),
sec_id VARCHAR (8),
semester VARCHAR (6),
YEAR NUMERIC (4,0),
0/1 pts Score: 0X
course);
PRIMARY KEY (ID, course_id, sec_id, semester, YEAR),
FOREIGN KEY (course_id, sec_id, semester, YEAR)
REFERENCES SECTION,
FOREIGN KEY (ID) ________ instructor);
The following entry is given in to the instructor relation
(100202,Drake, Biology,30000)
Identify the output of the query given
Row(s) inserted
Error in ID of insert
Error in Name of insert
Error in Salary of the insert
SELECT * FROM employee WHERE salary>10000 AND
dept_id=101;
Which of the following fields are displayed as output?
Salary, dept_id
Employee
Salary
All the field of employee relation
An ___ is a set of entities of the same type that share the same properties, or attributes.
Entity set
Attribute set
Relation set
Entity mode
Which of the following is the subset of SQL commands
used to manipulate database system structures
including tables?
Data Described Language
Data Retrieval Language
Data Manipulation Language
Data Definition Language
Which keyword is used to rename a relation in a
query?
RENAME
CHANGE
AS
MODIFY
Here which of the following displays the unique values
of the column?
SELECT___dept_name
FROM instructor;
From
Distinct
Name
All
What is the fundamental characteristic of data?
Subjectivity
Context-dependency
Organization
Meaningfulness
From the script, which is the main relation used in the
university database which is referenced by all other
relation of the university?
CREATE TABLE department
(dept_name VARCHAR (20),
building VARCHAR (15),
budget NUMBER,
PRIMARY KEY (dept_name));
CREATE TABLE course
(course_id VARCHAR (7),
title VARCHAR (50),
dept_name VARCHAR (20),
credits NUMERIC (2,0),
PRIMARY KEY (course_id),
FOREIGN KEY (dept_name)
department);
CREATE TABLE instructor
(ID VARCHAR (5),
name VARCHAR (20) NOT NULL,
dept_name VARCHAR (20),
salary NUMERIC (8,2),
FOREIGN KEY (dept_name)
CREATE TABLE SECTION
(course_id VARCHAR (8),
sec_id VARCHAR (8),
semester VARCHAR (6),
YEAR NUMERIC (4,0),
building VARCHAR (15),
room_number VARCHAR (7),
time_slot id VARCHAR (4),
PRIMARY KEY (course_id, sec_id, semester, YEAR),
FOREIGN KEY (_______)
CREATE TABLE teaches
(ID VARCHAR (5),
course_id VARCHAR (8),
sec_id VARCHAR (8),
semester VARCHAR (6),
YEAR NUMERIC (4,0),
course);
PRIMARY KEY (ID, course_id, sec_id, semester, YEAR),
FOREIGN KEY (course_id, sec_id, semester, YEAR)
REFERENCES SECTION,
FOREIGN KEY (ID)____instructor);
Teaches
Course
Department
Section
What is the primary function of a primary key in a
relational database?
To ensure that each row in a table is unique
To store large amounts of data efficiently
To provide a way to link multiple tables together
To perform complex calculations on the data
When designing a database, what is the significance
of normalizing the data?
To increase data redundancy
To complicate the database structure
To prevent data inconsistencies
To decrease data integrity
The query given below will not give an error. Which
one of the following has to be replaced to get the
desired output?
SELECT ID, name, dept name, salary * 1.1
WHERE instructor;
Salary*1.1
ID
Where
Instructor
Which of the following statements contains an error?
Select * from emp where empid = 10003;
Select empid from emp where empid = 10006;
Select empid from emp;
Select empid where empid = 1009 and lastname =
'GELLER';
What is the purpose of the GROUP BY clause in SQL?
To randomly group data without any logical
structure.
To create a logical structure that accurately
represents real-world entities and their
relationships.
To make the database more difficult to use.
To organize the result set into groups based on one
or more columns.
What is a foreign key?
A foreign key is a type of key used in cryptography
to encrypt data
A foreign key is a type of currency used in other
countries
A foreign key is a column or a set of columns in a
table that references the primary key of another
table, establishing a link between the two tables.
A foreign key is a key used to unlock doors in a
foreign country
What is the function of the following command?
Delete from r where P;
The function of the command is to update records
in the table 'r' where the condition 'P' is met.
The function of the command is to insert new
records into the table 'r' where the condition 'P' is
met.
The function of the command is to retrieve records
from the table 'r' where the condition 'P' is met.
The function of the command is to delete records
from the table 'r' where the condition 'P' is met.
The descriptive property possessed by each entity set
is ... .... ....
Entity
Attribute
Relation
Model
What does the notnull integrity constraint do?
It restricts the length of the column
It enforces a unique value in a column
It ensures that a column cannot have a null value.
It allows a column to have a null value
Which of the following commands do we use to delete
all the tuples from a relation (R)?
DELETE FROM R;
ERASE FROM R;
DROP FROM R;
REMOVE FROM R;
Which of the following syntax of the basic query is
correct?
select <relation> from <attribute>
select <attribute> from <relation>
select <tuple> from <relation>
select <tuple> from <attribute>
What is the role of SQL in relational databases?
SQL is used to create and manipulate tables in a
relational database.
SQL is used to design the user interface of a
relational database.
SQL is not relevant to relational databases.
SQL is used to perform mathematical calculations
in a relational database.
The primary key must be
Unique
Not null
Both Unique and Not null
Either Unique or Not null
What is the purpose of a database view in SQL?
To store data permanently
To provide a virtual table based on the result-set of
an SQL statement
To execute complex queries
To define primary keys
What is the primary purpose of organizing supertypes
and subtypes in a relational database system?
To make the database more difficult to use
To randomly group data without any logical
To create a logical structure that accurately
represents real-world entities and their
relationships.
To confuse the database administrators
What does the natural join operation do?
The natural join operation removes duplicate rows
from two tables
The natural join operation combines columns from
two tables based on a common value
The natural join operation multiplies the rows of
two tables together
The natural join operation combines rows from two
tables based on a common column between them.
A ....... indicates an absent value that may exist but
be unknown or that may not exist at all.
Empty tuple
New value
Null value
Old value
Which of the following is the correct option for the
given query?
SELECT DISTINCT name
FROM RDBMS
WHERE ID IS NOT NULL;
The query gives all the possible RDBMS names
where a finite value exists for ID
The query gives the RDBMS names where a finite
value exists for ID and it excludes identical names
The query gives the names of the RDBMS that
have a null ID and it also excludes identical names
The query is syntactically wrong
Which MySQL clause is used to filter the results of a
SELECT statement?
FILTER
WHERE
HAVING
LIMIT
Consider attributes ID, CITY and NAME. Which one of
these can be considered as a super key?
NAME
ID
CITY
CITY, ID
What is the primary purpose of normalizing a
database?
To make the database more difficult to use
To randomly group data without any logical
structure
To create a logical structure that accurately
represents real-world entities and their
relationships.
To confuse the database administrators
The ..... clause allows us to select only those rows in
the result relation of the ......... clause that satisfy a
specified predicate.
Where, from
From, select
Select, from
From, where
What is the purpose of the HAVING clause in SQL?
To filter rows based on a specified condition
To sort the result set in ascending order
To group rows that have the same values into summary rows
To filter groups based on a specified condition
From the script,
CREATE TABLE department
(dept_name VARCHAR (20),
building VARCHAR (15),
budget NUMBER,
PRIMARY KEY (dept_name));
CREATE TABLE course
(course_id VARCHAR (7),
title VARCHAR (50),
dept_name VARCHAR (20),
credits NUMERIC (2,0),
PRIMARY KEY (course_id),
FOREIGN KEY (dept_name)
department);
CREATE TABLE instructor
(ID VARCHAR (5),
name VARCHAR (20) NOT NULL,
dept_name VARCHAR (20),
salary NUMERIC (8,2),
FOREIGN KEY (dept_name)
CREATE TABLE SECTION
(course_id VARCHAR (8),
sec_id VARCHAR (8),
semester VARCHAR (6),
YEAR NUMERIC (4,0),
building VARCHAR (15),
room_number VARCHAR (7),
time_slot id VARCHAR (4),
PRIMARY KEY (course_id, sec_id, semester, YEAR),
FOREIGN KEY (_______)
___ course);
CREATE TABLE teaches
(ID VARCHAR (5),
course_id VARCHAR (8),
sec_id VARCHAR (8),
semester VARCHAR (6),
YEAR NUMERIC (4,0),
PRIMARY KEY (ID, course_id, sec_id, semester, YEAR),
FOREIGN KEY (course_id, sec_id, semester, YEAR)
REFERENCES SECTION,
FOREIGN KEY (ID) ________ instructor);
In the above DDL command the foreign key entries
obtained by using the keyword
References
Key reference
Relating
None of the mentioned
What is the purpose of the GROUP BY clause in SQL?
To filter rows based on a specified condition
To sort the result set in ascending order
To group rows that have the same values into
summary rows
To perform a join operation on multiple tables
________ deletes a data item from a database.
Insert(RDBMS)
Drop(RDBMS)
Delete(RDBMS)
None of the mentioned
How does a super key differ from a candidate key in
the context of a relational database system?
A super key uniquely identifies a tuple within a
relation, while a candidate key is a minimal super
key for a relation.
A super key is a minimal super key for a relation,
while a candidate key uniquely identifies a tuple
within a relation.
A super key is a combination of attributes that
uniquely identifies a tuple within a relation, while a
candidate key is a single attribute that uniquely
identifies a tuple within a relation.
A super key and a candidate key are the same
thing in the context of a relational database
system.
What is the definition of an attribute in the context of
a conceptual data model?
A type of function in programming languages
A specific value in a database table
An attribute in the context of a conceptual data
model refers to a characteristic or property of an
entity.
A method for organizing data in a spreadsheet
Which of the following commands do we use to delete
a relation (R) from a database?
DROP TABLE
ERASE TABLE
DELETE TABLE
REMOVE TABLE
Choose the correct statement regarding superkeys
A superkey is a set of attributes that is always a
single attribute.
A superkey is a set of attributes that can uniquely
identify a tuple within a relation.
A superkey is a set of attributes that is not related
to the primary key of a relation.
A superkey is a set of attributes that cannot
uniquely identify a tuple within a relation.
What is the purpose of the GROUP BY clause in SQL?
SELECT dept_name, avg(salary) FROM instructor
GROUP BY dept_name;
To group the result set by the specified column or
columns
To order the result set by the specified column or
columns
To filter the result set based on the specified
condition
To perform a join operation on the result set
In the context of a conceptual data model, which of
the following is true about relationships?
Relationships are only used in relational databases
Relationships represent the associations between
different entities or tables.
Relationships have no impact on the data model
Relationships represent the physical location of the data
Which of the following is a fundamental operation in relational algebra?
Selection
Union
Multiplication
Division
Course(course_id, sec_id, semester)
Here the course_id, sec_id and semester are.........
and course is a..........
Relations, Attribute
Attributes, Relation
Tuple, Relation
Tuple, Attributes
The term ... is used to refer to a row.
Attribute
Tuple
Field
Instance
What is the primary purpose of using foreign keys in a
relational database system?
To make the database more difficult to use
To create a logical structure that accurately
represents real-world entities and their
relationships.
To randomly group data without any logical
structure
To confuse the database administrators
Entity is a ........
Object of relation
Present working model
Thing in real world
Model of relation
Consider a Computer Sales Shop. Is the price of a
computer considered Data or Information?
The price of a computer is considered data.
The price of a computer is considered wisdom.
The price of a computer is considered knowledge.
The price of a computer is considered information.
How does information differ from data?
Data is qualitative, while information is quantitative
Data is raw facts and figures, while information is
processed data that has meaning and context.
Information is static, while data is dynamic
Information is unprocessed, while data is processed
Which of the following is true about the
Clothing, Shirt, and Shoe entities?
Clothing, Shirt, and Shoe are all subtypes
Clothing is a subtype, Shirt and Shoe are
supertypes
Clothing is a supertype, Shirt and Shoe are
subtypes
Shoe is a Cobbler type, Clothing is a Manufacturer
type, and Shirt is a Tailor type
An entity in A is associated with at most one entity in B, and an entity in B is associated with at most one entity in A. This is called as
One-to-many
One-to-one
Many-to-many
Many-to-one
What is the primary purpose of indexing in a
database?
To make the database more difficult to use
To randomly group data without any logical
structure
To create a logical structure that accurately
represents real-world entities and their
relationships.
To improve the speed of data retrieval and query
performance
From the script,
CREATE TABLE department
(dept_name VARCHAR (20),
building VARCHAR (15),
budget NUMBER,
PRIMARY KEY (dept_name));
CREATE TABLE course
(course_id VARCHAR (7),
title VARCHAR (50),
dept_name VARCHAR (20),
credits NUMERIC (2,0),
PRIMARY KEY (course_id),
FOREIGN KEY (dept_name)
department);
CREATE TABLE instructor
(ID VARCHAR (5),
name VARCHAR (20) NOT NULL,
dept_name VARCHAR (20),
salary NUMERIC (8,2),
FOREIGN KEY (dept_name)____department);
CREATE TABLE SECTION
(course_id VARCHAR (8),
sec_id VARCHAR (8),
semester VARCHAR (6),
YEAR NUMERIC (4,0),
building VARCHAR (15),
room_number VARCHAR (7),
time_slot id VARCHAR (4),
PRIMARY KEY (course_id, sec_id, semester, YEAR),
FOREIGN KEY (_______) ___ course);
CREATE TABLE teaches
(ID VARCHAR (5),
course_id VARCHAR (8),
sec_id VARCHAR (8),
semester VARCHAR (6),
YEAR NUMERIC (4,0),
PRIMARY KEY (ID, course_id, sec_id, semester, YEAR),
FOREIGN KEY (course_id, sec_id, semester, YEAR)
REFERENCES SECTION,
FOREIGN KEY (ID) ________ instructor);
Which of the following can be used as a primary key
entry of the instructor relation.
DEPT_NAME
NAME
ID
All of the mentioned
What is the primary key in a relational database?
A primary key is a unique identifier for a record in a
table.
A primary key is a foreign key in a table.
A primary key is a non-unique identifier for a
record in a table.
A primary key is not required in a relational
database.
What is the purpose of a foreign key in a relational
database?
To uniquely identify a record in a table
To establish a link between two tables
To store a unique identifier for a record
To perform mathematical operations on data
What is the purpose of the GROUP BY clause in SQL?
To randomly group data without any logical
structure.
To create a logical structure that accurately
represents real-world entities and their
relationships.
To make the database more difficult to use.
Your Answer
To organize the result set into groups based on one
or more columns.
Some of these insert statements will produce an error.
Identify the statement.
CREATE TABLE employee (id INTEGER,name
VARCHAR(20, salary NOT NULL);
INSERT INTO employee VALUES (1005, Rach,0);
INSERT INTO employee VALUES (1007,Ross, );
INSERT INTO employee VALUES (1002, Joey,335);
Insert into employee values (1005,Rach,0);
Insert into employee values (1002,Joey,335);
Insert into employee values (1007,Ross, );
None of the mentioned
_____ is a set of one or more attributes taken
collectively to uniquely identify a record.
Secondary key
Foreign key
Super key
Primary key
In MySQL, what is the purpose of the UNION operator
in a SELECT statement?
The purpose of the UNION operator is to delete
duplicate rows from the result set
The purpose of the UNION operator is to perform a
cross join between the result sets
The purpose of the UNION operator in a SELECT
statement in MySQL is to combine the result sets of
two or more SELECT statements into a single result
set.
The purpose of the UNION operator is to sort the
result set in ascending order
From the script,
CREATE TABLE department
(dept_name VARCHAR (20),
building VARCHAR (15),
budget NUMBER,
PRIMARY KEY (dept_name));
CREATE TABLE course
(course_id VARCHAR (7),
title VARCHAR (50),
dept_name VARCHAR (20),
credits NUMERIC (2,0),
PRIMARY KEY (course_id),
FOREIGN KEY (dept_name)
department);
CREATE TABLE instructor
(ID VARCHAR (5),
name VARCHAR (20) NOT NULL,
dept_name VARCHAR (20),
salary NUMERIC (8,2),
FOREIGN KEY (dept_name)
CREATE TABLE SECTION
(course_id VARCHAR (8),
sec_id VARCHAR (8),
semester VARCHAR (6),
YEAR NUMERIC (4,0),
building VARCHAR (15),
department);
room_number VARCHAR (7),
time_slot id VARCHAR (4),
PRIMARY KEY (course_id, sec_id, semester, YEAR),
FOREIGN KEY (_______) ____ course);
CREATE TABLE teaches
(ID VARCHAR (5),
course_id VARCHAR (8),
sec_id VARCHAR (8),
semester VARCHAR (6),
YEAR NUMERIC (4,0),
PRIMARY KEY (ID, course_id, sec_id, semester, YEAR),
FOREIGN KEY (course_id, sec_id, semester, YEAR)
REFERENCES SECTION,
FOREIGN KEY (ID)
instructor);
Identify the error in the section relation
No error
Year numeric (4,0)
Building varchar (15)
Sec_id varchar (8)
From the script,
CREATE TABLE department
(dept_name VARCHAR (20),
building VARCHAR (15),
budget NUMBER,
PRIMARY KEY (dept_name));
CREATE TABLE course
(course_id VARCHAR (7),
title VARCHAR (50),
dept_name VARCHAR (20),
credits NUMERIC (2,0),
PRIMARY KEY (course_id),
FOREIGN KEY (dept_name)
department);
CREATE TABLE instructor
(ID VARCHAR (5),
name VARCHAR (20) NOT NULL,
dept_name VARCHAR (20),
salary NUMERIC (8,2),
FOREIGN KEY (dept_name)
CREATE TABLE SECTION
(course_id VARCHAR (8),
sec_id VARCHAR (8),
semester VARCHAR (6),
YEAR NUMERIC (4,0),
building VARCHAR (15),
department);
room_number VARCHAR (7),
time_slot id VARCHAR (4),
PRIMARY KEY (course_id, sec_id, semester, YEAR),
FOREIGN KEY (_______)
___ course);
CREATE TABLE teaches
(ID VARCHAR (5),
X
course_id VARCHAR (8),
sec_id VARCHAR (8),
semester VARCHAR (6),
YEAR NUMERIC (4,0),
PRIMARY KEY (ID, course_id, sec_id, semester, YEAR),
FOREIGN KEY (course_id, sec_id, semester, YEAR)
REFERENCES SECTION,
FOREIGN KEY (ID) ____. instructor);
In the section relation which of the following is used as
a foreign key?
Course_id
Course_id,sec_id
Room_number
Course_id,sec_id,room_number
Drop Table cannot be used to drop a table referenced by a _______ constraint.
Local Key
Primary Key
Composite Key
Foreign Key
What does the following query do?
select name, ID, branch
from student, department
where student.branch = department.branch;
It gives all values of name, ID, branch from both
the relations only if all those attributes are present
in both
It gives all values of name, ID, branch from their
respective relations
It gives the values of name, ID, branch from their
respective relations where the values in the branch
attribute are same
It gives the values of name, ID, branch from their
respective relations where all the values are
matching with each other
Which of the following statements contains an error?
Select * from emp where empid = 10003;
Select empid from emp where empid = 10006;
Select empid from emp;
Select empid where empid = 1009 and lastname =
'GELLER';
What does the natural join operation do?
The natural join operation removes duplicate rows
from two tables
The natural join operation combines columns from
two tables based on a common value
The natural join operation multiplies the rows of
two tables together
The natural join operation combines rows from two
tables based on a common column between them.
How does the GROUP BY clause work in the context of
SQL queries?
It is used to sort the result set in ascending order
It is used to filter the result set based on a specified
condition
It is used to group the result set based on one or
more columns
It is used to perform mathematical operations on
the result set
This Query can be replaced by which one of the
following?
SELECT name, course_id
FROM instructor, teaches
WHERE instructor_ID= teaches_ID;
Select name,course_id from teaches,instructor
where instructor_id=course_id;
Select name, course_id from instructor natural join
teaches;
Select name, course_id from instructor;
Select course_id from instructor join teaches;
Which of the following statement is incorrect about
SQL Views?
Views are database objects.
Views Are a logical representation of existing tables
or of another view.
Views can contain data of their own.
Views are not "real" tables.
What is the syntax to load data into the database?
(Consider D as the database and a, b, c as data)
INSERT INTO D (column1, column2, column3)
VALUES (a, b, c);
CREATE TABLE D (a, b, c);
UPDATE D SET a=b, c=d;
ADD D (a, b, c) TO DATABASE;
Which of the following cannot be used to modify the data in a database?
delete
update
drop
insert
What is the role of a foreign key in a relational database?
To uniquely identify each record in a table
To establish a link between two tables
To perform mathematical operations on numeric
data
To define the primary key of a table
