CS 157
What does the following statement in SQL do? ALTER TABLE STUDENT ADD ADDRESS VARCHAR(20);
Adds a column called ADDRESS in the table student.
GRANT and REVOKE are:
DCL( Data control language)
If X --> YZ then X --> Y and X --> Z is
Decomposition Rule
To specify a list of values ............. Operator is used.
IN
In order to insert a row directly in the table, which command is used?
INSERT INTO
For a table R(B, O, I, S, Q, D), if S --> D, I --> B, IS --> Q, and B --> O, then what are the keys for R?
IS
Which of the following is/are valid aggregate function(s) in SQL? max() sum() count() avg()
all of them
Let R(A,B,C,D) be a relation schema and F = {A -> BC, AB -> D, B->C } be the set of functional dependencies over R. Which of the following represents the closure of the attribute set {B}? {A,B,C} {B} {A,C,D} {B,C}
{B,C}
Which of the following statements is/are correct regarding these three keys (Primary Key, Super Key, and Candidate Key) in a database? Minimal super key is a candidate key A super key can be a candidate key Candidate key is always same as super key Only one candidate key can be a primary key
Minimal super key is a candidate key A super key can be a candidate key Only one candidate key can be a primary key
What is the equivalent of a Cartesian Product?
Cross Join
In a functional dependency X -> Y, if Y is functionally dependent on X but not on the proper subset of X then this functional dependency is called
Full Functional Dependency
With the Union clause, each query involved must output the same number of columns and be Union compatible
True
____________________ is such a join that specifies that all records be fetched from the table on the left side of the join statement.
Left Join
A join may include how many tables?
1 2 or 3
Two relations have 4 and 8 tuples respectively. If they are multiplied according to the rules of a Cartesian product how many tuples will be there in end result?
32
If A --> B, B --> C, and C --> D, then which of the following is/are true?
A --> D A --> C B --> D
If A -> B has a trivial functional dependency, then which of the following statement is true?
B is a subset of A
Which SQL function is used to count the number of rows in a SQL query?
COUNT(*)
A multivalued attribute in ER digram is represented by
Double oval
Assume that (RegNo, Name), (Edu, Gen), (Phone, RegNo), and (RegNo) are the super keys for a relation.Which of the following is the candidate key for this relation?
Regno
Consider a table "weather" with columns: city, humidity, and temperature Find all cities whose humidity is 100. SELECT city WHERE humidity = 100; SELECT city FROM weather WHERE humidity = 100; SELECT city FROM weather; SELECT humidity = 100 FROM weather;
SELECT city FROM weather WHERE humidity = 100;
Consider a table "weather" with columns: city and temperature Which of this query will be used to get all cities with temperature in decreasing order? SELECT city FROM weather ORDER BY temperature; SELECT city, temperature FROM weather ORDER BY city; SELECT city, temperature FROM weather; SELECT city, temperature FROM weather ORDER BY temperature DESC;
SELECT city, temperature FROM weather ORDER BY temperature DESC;
Subqueries can be nested multiple times. TRUE OR FALSE
TRUE
The conceptual Level of data abstraction is a complete view of the data requirements of the organization that is independent of any storage considerations. TRUE OR FALSE
TRUE
How can you change "Thomas" into "Michel" in the "LastName" column in the Users table? MODIFY Users SET LastName = 'Thomas' INTO LastName = 'Michel' UPDATE User SET LastName = 'Thomas' INTO LastName = 'Michel' UPDATE Users SET LastName = 'Michel' WHERE LastName = 'Thomas' MODIFY Users SET LastName = 'Michel' WHERE LastName = 'Thomas
UPDATE Users SET LastName = 'Michel' WHERE LastName = 'Thomas'
_______________________ form has a table that contains one or more repeating groups.
Unnormalized
Consider a relational schema S=(U,V,W,X,Y,Z) on which the following dependencies hold: {U -> V, VW -> X, Y-> W, X -> U} Which of the following is/are candidate keys for the relational schema? XY VYZ XYZ UYZ VY
VYZ XYZ UYZ