WorksheetsDBSM 121-180
Total questions: 60
Worksheet time: 30mins
Choose the correct relational algebra operation
Union
Difference
Intersection
Product
Choose the correct relational algebra operation
Union
Difference
Intersection
Product
Choose the correct relational algebra operation
Union
Difference
Intersection
Product
Choose the correct relational algebra
operation
Union
Difference
Intersection
Product
The SQL WHERE clause
Condition that limits the column data that are returned
Condition that limits the row data are returned
Clause that returns all rows
Clause that returns nothing
The command to eliminate a table from a database
Drop
Delete
Remove
Update
Which of the following is correct order of keywords for SQL Select statement?
SELECT, FROM, WHERE
WHERE, FROM, SELECT
FROM, WHERE, SELECT
SELECT, WHERE, FROM
Are given table union compatible ?
Yes
No
I do not know
May be
SQL data definition commands make up a(n)
DDC
DML
DDL
DDD
In a relation, the columns are also called attributes
True
False
May be
I do not know
Find the SQL statement that is equal to: SELECT NAME FROM CUSTOMER
WHERE STATE = 'VA';
SELECT NAME IN CUSTOMER WHERE STATE IN 'VA';
SELECT NAME IN CUSTOMER WHERE STATE = 'VA';
SELECT NAME FROM CUSTOMER WHERE STATE IN 'VA';
SELECT NAME IN CUSTOMER WHERE STATE = 'V';
In E\R diagrams, we will represent Entities as
Boxes with rounded corners
Links between two entities
Ovals
• Diamond box
In E\R diagrams, we will represent Relationships as
Boxes with rounded corners
Links between two entities
Ovals
Diamond box
In E\R diagrams, we will represent Attributes as
Boxes with rounded corners
Links between two entities
Ovals
Diamond box
Many to many relationships are difficult to represent in database, so we need
to
Split many to many relationship into two one to many relationships
Split one to many relationship into two one to many relationships
Split many to many relationship into one to many relationships
Split many to many relationship into three one to many relationships
The result of a SQL SELECT statement is a(n)
Report
Table
Form
File
Which of the following are the five built-in functions provided by SQL?
COUNT, SUM, AVG, MAX, MULT
SUM, AVG, MIN, MAX, NAM
SUM, AVG, MULT, DIV, MIN
COUNT, SUM, AVG, MAX, MIN
In a relation, the order of the rows matters
True
False
I do not know
May be
Given the functional dependency R → (S,T) , then it is also true that R → S
True
False
I do not know
May be
Given the functional dependency R → (S,T) , then it is also true that R → T
True
False
I do not know
May be
SQL can be used to
create database structures only
query database data only
modify database data only
All of the these can be done by SQL
The SQL statement that queries or reads data from a table is ________
READ
QUERY
SELECT
NONE
A subquery in an SQL SELECT statement
can only be used with two tables
has a distinct form that cannot be duplicated by a join
can always be duplicated by a join
cannot have its results sorted using ORDER BY
The SQL keyword BETWEEN is used
for ranges
as a wildcard
to limit the columns displayed
None of the above
Sometimes you want to change the structure of an existing table, what are your
options?
Change table
Drop Table
Alter Table
Create Table
how to Add a new column into existing table?
ALTER TABLE Student MODIFY COLUMN sDegree CHAR(64) NOT NULL
ALTER TABLE Student ADD COLUMN sDegree VARCHAR(64) NOT NULL
ALTER TABLE S ADD COLUMN s VACHAR(64) NOT NULL
ALTER TABLE Student DROP COLUMN sDegree VARCHAR(64) NOT NULL
how to
rename a column in existing table?
ALTER TABLE Student MODIFY COLUMN sDegree CHAR(64) NOT NULL
ALTER TABLE Student ADD COLUMN sDegree VARCHAR(64) NOT NULL
ALTER TABLE Student RENAME COLUMN s to SS VACHAR(64) NOT NULL
ALTER TABLE Student DROP COLUMN sDegree VARCHAR(64) NOT NULL
how to change the row(s) in a table
insert
update
change
delete
how to remove the row(s) from a table
insert
update
change
delete
Which of the following is not correct ?
INSERT INTO Employee(ID, Name, Salary) VALUES(2,‘Mary’,26);
INSERT INTO Employee (Name,ID) VALUES (‘Mary’,2);
INSERT INTO Employee VALUES (2, ‘Mary’,26000);
INSERT INTO Employe VALUES(26, ‘Mary’,26);
Please increase salary for 10% ?
UPDATE Employee SET Salary = Salary*0.5
UPDATE Employee SET Salary = Salary * 0.1
UPDATE Employee SET Salary = Salary * 1.1
UPDATE Employee Update Salary = Salary*0.1
Please remove staff, who earns more than 22000 ?
DELETE FROM Employee WHERE Salary >=22000;
DELETE FROM Employe WHERE Salary => 22000;
REMOVE FROM Employee WHERE Salary >22000;
DELETE FROM Employee WHERE Salary = 22000;
πsName,sAddress(Student) is
equal to?
SELECT Sname FROM Students
SELECT Sname, SAddress FORM Students
SELECT Sname and SAddress FROM Students
SELECT Sname, SAddress FROM Student
SQL query to find a list of the ID numbers and Marks for
students who have passed IAI
Select ID, Mark from Grade Where code = 'IAI' and Mark > 50;
Select ID, Mark from Grade Where code = 'AIA' and Mark > 50;
Select ID, Mark, Code from Grade Where code = 'IAI';
Select ID, Mark from Grade Where code = 'IAI' and Mark >=50;
Find students who studying any Programming module
Select First,Last from Student,Grade Where Code='PR1'OR'PR2'
Select First,Last from Student Natural Join Grade Where Code like'PR%'
Select First Last from Student Natural Join Grade Where Code like'PR%'
Select First from Student Natural Join Grade Where Code = 'PR%'
A SELECT statement can be nested inside another query to form a
Subselect
Subresults
Subquery
Query in query
SQL uses privileges to control access to tables and other database objects, so
which is NOT?
Select privilege
Update privilege
Insert privilege
Drop privilege
How to use privileges in SQL?
ON<objects> TO<users> GRANT<privileges>
GRANT<privileges> ON<objects> TO<users>
GRANT<privileges> TO<users> ON<objects>
GRANT<tables> ON<objects> TO<users>
If Admin’ grants ALL privileges to ‘Manager’, and
SELECT to ‘Finance’ with grant option, So..
‘Manager’ grants ALL to ‘Personnel’
‘Manager’ grants SELECT to ‘Personnel’
‘Finance’ grants SELECT to ‘Manager’
‘Finance’ grants ALL to ‘Manager’
If Admin’ grants ALL privileges to ‘Manager’, and
SELECT to ‘Finance’ with grant option, So..
‘Finance’ grants SELECT to ‘Personnel’
‘Manager’ grants SELECT to ‘Personnel’
‘Finance’ grants SELECT to ‘Manager’
‘Finance’ grants ALL to ‘Manager’
If ‘Manager’ revokes ALL from ‘Personnel’
‘Personnel’ still has ALL privileges from ‘Finance
‘Finance’ still has SELECT privileges from ‘Personnel’
‘Personnel’ still has SELECT privileges from ‘Finance’
‘Admin’ still has ALL privileges from ‘Finance’
If ‘Finance revokes SELECT from ‘Personnel’
‘Personnel’ still has ALL privileges from ‘Finance’
‘Finance’ still has SELECT privileges from ‘Personnel’
‘Personnel’ still has ALL privileges from ‘Manager’
‘Admin’ still has ALL privileges from ‘Finance’
If ‘Admin’ revokes Select from ‘Finance’
‘Personnel’ still has ALL privileges from ‘Finance’
‘Finance’ still has SELECT privileges from ‘Personnel’
‘Personnel’ still has ALL privileges from ‘Manager’
‘Admin’ still has ALL privileges from ‘Finance’
If ‘Admin’ revokes ALL from ‘Manager’
‘Personnel’ still has ALL privileges from ‘Finance’
‘Finance’ still has SELECT privileges from ‘Personnel’
‘Finance still has SELECT privileges from ‘Admin’
‘Admin’ still has ALL privileges from ‘Finance’
If Admin’ grants ALL privileges to ‘Manager’, and
SELECT to ‘Finance’ with grant option, So..
‘Manager’ grants ALL to ‘Personnel’
‘Manager’ grants SELECT to ‘Personnel’
‘Finance’ grants SELECT to ‘Manager’
‘Finance’ grants ALL to ‘Manager’
To convert any relation into _______, split any nonatomic values
First normal form
Second normal form
Third normal form
Fourth normal form
A functional dependency (FD) is a
link between three sets of attributes in a relation
link between all sets of attributes in a relation
link between four sets of attributes in a relation
link between two sets of attributes in a relation
which if the following does not refer to redundancy problems?
INSERT anomalies
CREATE anomalies
UPDATE anomalies
DELETE anomalies
To convert any relation into _______, remove transitive dependency
First normal form
Second normal form
Third normal form
Fourth normal form
To convert any relation into _______, split any nonatomic values
First normal form
Second normal form
Third normal form
Fourth normal form
A functional dependency (FD) is a
link between three sets of attributes in a relation
link between all sets of attributes in a relation
link between four sets of attributes in a relation
link between two sets of attributes in a relation
which if the following does not refer to redundancy problems?
INSERT anomalies
CREATE anomalies
UPDATE anomalies
DELETE anomalies
To convert any relation into _______, remove transitive dependency
First normal form
Second normal form
Third normal form
Fourth normal form
SQL stands for
Sequence Question Language
Structured Query Language
Structured Querty Language
Selection Query Language
What is it ?
Relation
Tuples
Attributes
Relationships
What is it ?
Relation
Tuples
Attributes
Relationships
What is it ?
Relation
Tuples
Attributes
Relationships
which if the following does not refer to redundancy problems?
INSERT anomalies
CREATE anomalies
UPDATE anomalies
DELETE anomalies
To convert any relation into _______, remove transitive dependency
First normal form
Second normal form
Third normal form
Fourth normal form
To convert any relation into _______, split any nonatomic values
First normal form
Second normal form
Third normal form
