DBI202_sanfoundry

Ace your homework & exams now with Quizwiz!

8. 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. a) Attributes of common b) Tuple of common c) Tuple of distinct d) Attributes of distinct

c

6. The _______operation performs a set union of two "similarly structured" tables a) Union b) Join c) Product d) Intersect

a

'_ _ _ ' matches any string of ______ three characters. '_ _ _ %' matches any string of at ______ three characters. a) Atleast, Exactly b) Exactly, Atleast c) Atleast, All d) All , Exactly

b

2. SQL applies predicates in the _______ clause after groups have been formed, so aggregate functions may be used. a) Group by b) With c) Where d) Having

b

6. WITH max_budget (VALUE) AS (SELECT MAX(budget) FROM department) SELECT budget FROM department, max_budget WHERE department.budget = MAX budget.value; In the query given above which one of the following is a temporary relation ? a) Budget b) Department c) Value d) Max_budget

d

7. A attribute in a relation is a foreign key if the _______ key from one relation is used as an attribute in that relation . a) Candidate b) Primary c) Super d) Sub

b

7. The number of attributes in relation is called as its a) Cardinality b) Degree c) Tuples d) Entity

b

7.Course(course_id,sec_id,semester) Here the course_id,sec_id and semester are __________ and course is a _________ a) Relations, Attribute b) Attributes, Relation c) Tuple, Relation d) Tuple, Attributes

b

8. SELECT instructor.* FROM instructor, teaches WHERE instructor.ID= teaches.ID; This query does which of the following operation? a) All attributes of instructor and teaches are selected b) All attributes of instructor are selected on the given condition c) All attributes of teaches are selected on given condition d) Only the some attributes from instructed and teaches are selected

b

8. Delete from r; r - relation This command performs which of the following action ? a) Remove relation b) Clear relation entries c) Delete fields d) Delete rows

b

8. The _______ operator takes the results of two queries and returns only rows that appear in both result sets. a) Union b) Intersect c) Difference d) Projection

b

1. SELECT name ____ instructor name, course id FROM instructor, teaches WHERE instructor.ID= teaches.ID; Which keyword must be used here to rename the field name ? a) From b) Rename c) As d) Join

c

1. A _____ indicates an absent value that may exist but be unknown or that may not exist at all. a) Empty tuple b) New value c) Null value d) Old value

c

8. Which of the following is not a aggregate function ? a) Avg b) Sum c) With d) Min

c

9. In SQL the spaces at the end of the string are removed by _______ function . a) Upper b) String c) Trim d) Lower

c

6. Using the ______ clause retains only one copy of such identical tuples. a) Null b) Unique c) Not null d) Distinct

d

4. Select * from employee What type of statement is this? a) DML b) DDL c) View d) Integrity constraint

a

9. A ________ is a pictorial depiction of the schema of a database that shows the relations in the database, their attributes, and primary keys and foreign keys. a) Schema diagram b) Relational algebra c) Database diagram d) Schema flow

a

2. SELECT __________ FROM instructor WHERE dept name= 'Comp. Sci.'; Which of the following should be used to find the mean of the salary ? a) Mean(salary) b) Avg(salary) c) Sum(salary) d) Count(salary)

b

2. SELECT * FROM employee WHERE dept_name="Comp Sci"; In the SQL given above there is an error . Identify the error . a) Dept_name b) Employee c) "Comp Sci" d) From

c

2. A ________ in a table represents a relationship among a set of values. a) Column b) Key c) Row d) Entry

c

2. Select ________ dept_name from instructor; Here which of the following displays the unique values of the column ? a) All b) From c) Distinct d) Name

c

6. The ____ connective tests for set membership, where the set is a collection of values produced by a select clause. The ____ connective tests for the absence of set membership. a) Or, in b) Not in, in c) In, not in d) In, or

c

7. 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); Some of these insert statements will produce an error. Identify the statement. a) Insert into employee values (1005,Rach,0); b) Insert into employee values (1002,Joey,335); c) Insert into employee values (1007,Ross, ); d) None of the mentioned

c

7. Subqueries cannot: a) Use group by or group functions b) Retrieve data from a table different from the one in the outer query c) Join tables d) Appear in select, update, delete, insert statements.

c

7. The most commonly used operation in relational algebra for projecting a set of tuple from a relation is a) Join b) Projection c) Select d) Union

c

10. The result of _____unknown is unknown. a) Xor b) Or c) And d) Not

d

1. The union operation is represented by a) ∩ b) U c) - d) *

b

5. The ________ clause is used to list the attributes desired in the result of a query. a) Where b) Select c) From d) Distinct

b

. SELECT emp_name FROM department WHERE dept_name LIKE ' _____ Computer Science'; Which one of the following has to be added into the blank to select the dept_name which has Computer Science as its ending string ? a) % b) _ c) || d) $

a

1. A Delete command operates on ______ relation. a) One b) Two c) Several d) Null

a

1. A relational database consists of a collection of a) Tables b) Fields c) Records d) Keys

a

1. Aggregate functions are functions that take a ___________ as input and return a single value. a) Collection of values b) Single value c) Aggregate value d) Both Collection of values & Single value

a

1. Using which language can a user request information from a database ? a) Query b) Relational c) Structural d) Compiler

a

10. A _________ integrity constraint requires that the values appearing in specified attributes of any tuple in the referencing relation also appear in specified attributes of at least one tuple in the referenced relation. a) Referential b) Referencing c) Specific d) Primary

a

10. The _____________ is essentially used to search for patterns in target string. a) Like Predicate b) Null Predicate c) In Predicate d) Out Predicate

a

10. The tuples of the relations can be of ________ order. a) Any b) Same c) Sorted d) Constant

a

10. Updates that violate __________ are disallowed. a) Integrity constraints b) Transaction control c) Authorization d) DDL constraints

a

2. Delete from r where P; The above command a) Deletes a particular tuple from the relation b) Deletes the relation c) Clears all entries from the relation d) All of the mentioned

a

2. Which one of the following provides the ability to query information from the database and to insert tuples into, delete tuples from, and modify tuples in the database ? a) DML(Data Manipulation Langauge) b) DDL(Data Definition Langauge) c) Query d) Relational Schema

a

3. The ______ clause allows us to select only those rows in the result relation of the ____ clause that satisfy a specified predicate. a) Where, from b) From, select c) Select, from d) From, where

a

3. The subset of super key is a candidate key under what condition ? a) No proper subset is a super key b) All subsets are super keys c) Subset is a super key d) Each subset is a super key

a

4. If we want to retain all duplicates, we must write ________ in place of union. a) Union all b) Union some c) Intersect all d) Intersect some

a

5. For each attribute of a relation, there is a set of permitted values, called the ________ of that attribute. a) Domain b) Relation c) Set d) Schema

a

5. Which of the following creates temporary relation for the query on which it is defined ? a) With b) From c) Where d) Select

a

6. An attribute A of datatype varchar(20) has the value "Avi" . The attribute B of datatype char(20) has value "Reed" .Here attribute A has ____ spaces and attribute B has ____ spaces. a) 3, 20 b) 20, 4 c) 20 , 20 d) 3, 4

a

6. For like predicate which of the following is true. i) % matches zero OF more characters. ii) _ matches exactly one CHARACTER. a) i-only b) ii-only c) Both of the mentioned d) None of the mentioned

a

7. SELECT name FROM instructor WHERE salary <= 100000 AND salary >= 90000; This query can be replaced by which of the following ? a) SELECT name FROM instructor WHERE salary BETWEEN 90000 AND 100000; b) SELECT name FROM employee WHERE salary <= 90000 AND salary>=100000; c) SELECT name FROM employee WHERE salary BETWEEN 90000 AND 100000; d) SELECT name FROM instructor WHERE salary BETWEEN 100000 AND 90000;

a

9. The EXISTS keyword will be true if: a) Any row in the subquery meets the condition only b) All rows in the subquery fail the condition only c) Both of these two conditions are met d) Neither of these two conditions is met

a

9. You attempt to query the database with this command: SELECT nvl (100 / quantity, NONE) FROM inventory; Why does this statement cause an error when QUANTITY values are null? a) The expression attempts to divide by a null value b) The data types in the conversion function are incompatible c) The character string none should be enclosed in single quotes (' ') d) A null value used in an expression cannot be converted to an actual value

a

SELECT COUNT (____ ID) FROM teaches WHERE semester = 'Spring' AND YEAR = 2010; If we do want to eliminate duplicates, we use the keyword ______in the aggregate expression. a) Distinct b) Count c) Avg d) Primary key

a

1. SELECT dept_name, ID, avg (salary) FROM instructor GROUP BY dept_name; This statement IS erroneous because a) Avg(salary) should not be selected b) Dept_id should not be used in group by clause c) Misplaced group by clause d) Group by clause is not valid in this query

b

1. Which one of the following is used to define the structure of the relation ,deleting relations and relating schemas ? a) DML(Data Manipulation Langauge) b) DDL(Data Definition Langauge) c) Query d) Relational Schema

b

10. How can you find rows that do not match some specified condition? a) EXISTS b) Double use of NOT EXISTS c) NOT EXISTS d) None of the mentioned

b

10. Insert into employee _____ (1002,Joey,2000); In the given query which of the keyword has to be inserted ? a) Table b) Values c) Relation d) Field

b

10. The _________ provides a set of operations that take one or more relations as input and return a relation as an output. a) Schematic representation b) Relational algebra c) Scheme diagram d) Relation flow

b

10. We can test for the nonexistence of tuples in a subquery by using the _____ construct. a) Not exist b) Not exists c) Exists d) Exist

b

2. Consider attributes ID , CITY and NAME . Which one of this can be considered as a super key ? a) NAME b) ID c) CITY d) CITY , ID

b

2. The intersection operator is used to get the _____ tuples. a) Different b) Common c) All d) Repeating

b

3. Aggregate functions can be used in the select list or the_______clause of a select statement or subquery. They cannot be used in a ______ clause. a) Where, having b) Having, where c) Group by, having d) Group by, where

b

3. Create table employee (name varchar ,id integer) What type of statement is this ? a) DML b) DDL c) View d) Integrity constraint

b

3. The term _______ is used to refer to a row. a) Attribute b) Tuple c) Field d) Instance

b

4. SELECT name FROM instructor WHERE salary IS NOT NULL; Selects a) Tuples with null value b) Tuples with no null values c) Tuples with any salary d) All of the mentioned

b

4. A _____ is a property of the entire relation, rather than of the individual tuples in which each tuple is unique. a) Rows b) Key c) Attribute d) Fields

b

4. All aggregate functions except _____ ignore null values in their input collection. a) Count(attribute) b) Count(*) c) Avg d) Sum

b

4. The ________ keyword is used to access attributes of preceding tables or subqueries in the from clause. a) In b) Lateral c) Having d) With

b

4. The term attribute refers to a ___________ of a table. a) Record b) Column c) Tuple d) Key

b

4. The_____ operation allows the combining of two relations by merging pairs of tuples, one from each relation, into a single tuple. a) Select b) Join c) Union d) Intersection

b

5. In a employee table to include the attributes whose value always have some value which of the following constraint must be used ? a) Null b) Not null c) Unique d) Distinct

b

5. The result which operation contains all pairs of tuples from the two relations, regardless of whether their attribute values match. a) Join b) Cartesian product c) Intersection d) Set difference

b

6. Select name, course_id from instructor, teaches where instructor_ID= teaches_ID; This Query can be replaced by which one of the following ? a) Select name,course_id from teaches,instructor where instructor_id=course_id; b) Select name, course_id from instructor natural join teaches; c) Select name ,course_id from instructor; d) Select course_id from instructor join teaches;

b

8. The relation with the attribute which is the primary key is referenced in another relation. The relation which has the attribute as primary key is called a) Referential relation b) Referencing relation c) Referenced relation d) Referred relation

b

9. A domain is atomic if elements of the domain are considered to be ____________ units. a) Different b) Indivisbile c) Constant d) Divisible

b

9. Insert into instructor values (10211, 'Smith', 'Biology', 66000); What type of statement is this ? a) Query b) DML c) Relational d) DDL

b

9. _________ joins are SQL server default a) Outer b) Inner c) Equi d) None of the mentioned

b

1. Name Annie Bob Callie Derek Which of these query will display the the table given above ? a) Select employee from name b) Select name c) Select name from employee d) Select employee

c

1. Which one of the following is a set of one or more attributes taken collectively to uniquely identify a record? a) Candidate key b) Sub key c) Super key d) Foreign key

c

10. _____ operator is used for appending two strings. a) & b) % c) || d) _

c

2. If the attribute phone number is included in the relation all the values need not be entered into the phone number column . This type of entry is given as a) 0 b) - c) Null d) Empty space

c

3. Which one of the following is a procedural language ? a) Domain relational calculus b) Tuple relational calculus c) Relational algebra d) Query language

c

4. Select ID, name, dept name, salary * 1.1 where instructor; The query given below will not give an error. Which one of the following has to be replaced to get the desired output? a) Salary*1.1 b) ID c) Where d) Instructor

c

5. The basic data type char(n) is a _____ length character string and varchar(n) is _____ length character. a) Fixed, equal b) Equal, variable c) Fixed, variable d) Variable, equal

c

5. Which one of the following attribute can be taken as a primary key ? a) Name b) Street c) Id d) Department

c

6. SELECT * FROM instructor ORDER BY salary ____, name ___; To display the salary from greater to smaller and name in ascending order which of the following options should be used ? a) Ascending, Descending b) Asc, Desc c) Desc, Asc d) Descending, Ascending

c

8. The primary key must be a) Unique b) Not null c) Both Unique and Not null d) Either Unique or Not null

c

8. _____ clause is an additional filter that is applied to the result. a) Select b) Group-by c) Having d) Order by

c

9. The ______ is the one in which the primary key of one relation is used as a normal attribute in another relation. a) Referential relation b) Referencing relation c) Referenced relation d) Referred relation

c

5. SELECT name FROM instructor WHERE dept name = 'Physics' ORDER BY name; By default, the order by clause lists items in ______ order. a) Descending b) Any c) Same d) Ascending

d

5. A Boolean data type that can take values true, false, and________ a) 1 b) 0 c) Null d) Unknown

d

6. Database __________ which is the logical design of the database, and the database _______ which is a snapshot of the data in the database at a given instant in time. a) Instance, Schema b) Relation, Schema c) Relation, Domain d) Schema, Instance

d

6. Which one of the following cannot be taken as a primary key ? a) Id b) Register number c) Dept_id d) Street

d

7. Select * from employee where salary>10000 and dept_id=101; Which of the following fields are displayed as output? a) Salary, dept_id b) Employee c) Salary d) All the field of employee relation

d

7. To remove a relation from an SQL database, we use the ______ command. a) Delete b) Purge c) Remove d) Drop table

d

8. Employee_id Name Salary 1001 Annie 6000 1009 Ross 4500 1018 Zeith 7000 This is Employee table. Select * from employee where employee_id>1009; Which of the following employee_id will be displayed? a) 1009, 1001, 1018 b) 1009, 1018 c) 1001 d) 1018

d

8. The phrase "greater than at least one" is represented in SQL by _____ a) < all b) < some c) > all d) > some

d

9. Which of the following statements contains an error? A) Select * from emp where empid = 10003; B) Select empid from emp where empid = 10006; C) Select empid from emp; D) Select empid where empid = 1009 and lastname = 'GELLER';

d

2. Student(ID, name, dept name, tot_cred) In this query which attribute form the primary key? a) Name b) Dept c) Tot_cred d) ID

d

3. The predicate in a where clause can involve Boolean operations such as and.The result of true and unknown is_______ false and unknown is _____ while unknown and unknown is _____ a) Unknown, unknown, false b) True, false, unknown c) True, unknown, unknown d) Unknown, false, unknown

d

3. The union operation automatically __________, unlike the select clause. a) Adds tuples b) Eliminates unique tuples c) Adds common tuples d) Eliminates duplicate

d

5. (SELECT course id FROM SECTION WHERE semester = 'Fall' AND YEAR= 2009) EXCEPT (SELECT course id FROM SECTION WHERE semester = 'Spring' AND YEAR= 2010); This query displays a) Only tuples from second part b) Only tuples from the first part which has the tuples from second part c) Tuples from both the parts d) Tuples from first part which do not have second part

d


Related study sets

Arkansas Keyboarding Connections Unit 6 - Tables

View Set

Chapter 4: Video Camera Operations

View Set

2.) The Pleistocene-Holocene Transition:

View Set

Lines in the coordinate plane/ 3-6

View Set

WBC Morphology, Structure, and Function

View Set

World History Chapter 13: European Middle Ages: Sections 1, 2, 3, and 4

View Set

Declaration of independence vocabulary supplement quiz

View Set