Sunteți pe pagina 1din 16

Chapter 6Relational Databases and SQL

TRUE/FALSE 1. An entity in an accounting system can be classified as a resource, event, agent, or location. ANS: T 2. A field is an item of data that characterizes an entity or relationship. ANS: F 3. Attributes that consist of multiple subattributes are referred to as primary attributes. ANS: F 4. A key attribute is the attribute whose value is unique for every entity that will appear in the database. ANS: T 5. The customer street address is often used as the key attribute in an REA diagram. ANS: F 6. In an REA diagram, the rectangle is used to represent the composite attribute. ANS: F 7. The first step in REA is evaluating the attributes. ANS: F 8. Relationships define and map the way in which data can be extracted from a database in the future. ANS: T 9. A recursive relationship is a relationship between two different instances of an entity. ANS: T 10. The DBMS approach yields data redundancies when a supervisor is supervised by a third employee. ANS: F 11. A recursive relationship is created when there is an employee being supervised, and another employee is the supervisor. ANS: T 12. Cardinality constraints relate to the specification of how many occurrences of an entity can participate in a given relationship with any one occurrence of the other entity in the relationship.

ANS: T 13. The cardinality constraint is used to specify both the minimum and maximum participation of one entity in the relationship with the other entity. ANS: F 14. The notation 1,N is used to specify the relationship type of one to many. ANS: T 15. The notation of (1,1) is used to specify the relationship type of one to many. ANS: F 16. REA stands for resources, entities and agents ANS: F 17. The fundamental requirement for moving toward an event driven model is the complete integration of data related to an organizations business events. ANS: T 18. Enterprise systems are integrated software packages designed to provide complete integration of an organization's business information processing systems and all related data. ANS: T 19. A collection of data representing multiple occurrences of an object, event, or agent is known as a relation. ANS: T 20. A set of data that describes an instance of the entity represented by a relation is known as a tuple. ANS: T 21. A missing value is called a non-null. ANS: F 22. The secondary key is specified to identity each tuple in the relation. ANS: F 23. SQL is a powerful database language that can be used to define database systems, query the database for information, generate reports from the database, and access databases from within programs using embedded commands. ANS: T

24. Referential integrity specifies that for every attribute in one relation that has been specified to allow reference to another relation, the tuple being referenced must be intact. ANS: T 25. A relation in an ER model is the same as an entity in the REA model. ANS: F 26. Most DBMS programs today that include SQL also include mechanisms within the DBMS itself for enforcing referential integrity. ANS: T 27. The INSERT command is used to add a single tuple to an existing relation. ANS: T 28. The UPDATE command demonstrates one of the weaknesses in most forms of SQL. ANS: F 29. The DELETE command is used when we want to change one or more attribute values. ANS: F 30. Queries of a database are driven by SELECT commands. ANS: T MULTIPLE CHOICE 1. An entity can be classified as all of the following except a. resource b. event c. tuple d. agent ANS: C 2. A(n) ____ of an entity is anything in which we are interested that exists independently. a. agent b. composite attribute c. attribute d. instance ANS: D 3. A(n) ____ is an item of data that characterizes an entity or relationship a. agent b. composite attribute c. attribute d. instance

ANS: C 4. Which of the following is the entity or agent? a. client b. client number c. client name d. client street address ANS: A 5. Which of the following is the key attribute? a. client b. client number c. client name d. client street address ANS: B 6. Which of the following is an attribute but least likely to be the key attribute? a. client b. client number c. client name d. client street address ANS: D 7. Which of the following is a subattribute? a. client b. client number c. client name d. client street address ANS: D 8. A data field in a traditional file is similar to a relational: a. table b. attribute c. tuple d. row ANS: B 9. For the following entity and attribute model, what would be the key attribute of the Students entity?

a. b. c. d.

social security number name address street

ANS: A 10. A key attribute is the attribute whose value is: a. undeterminable b. unique c. large d. the same for all attributes ANS: B 11. The mapping of the relationships between entities would be used in the development of a(n): a. context diagram b. logical DFD c. physical DFD d. REA Model ANS: D 12. The sequence of steps in identifying relationships in a model is: a. evaluate entities as pairs, identify user existing and desired information, evaluate each entity to determine if there is any need for two occurrences of the same entity type to be linked b. identify user existing and desired information, evaluate entities as pairs, evaluate each entity to determine if there is any need for two occurrences of the same entity type to be linked c. evaluate entities as pairs, evaluate each entity to determine if there is any need for two occurrences of the same entity type to be linked, identify user existing and desired information d. evaluate each entity to determine if there is any need for two occurrences of the same entity type to be linked, evaluate entities as pairs, identify user existing and desired information ANS: B 13. A recursive relationship is a relationship: a. between two similar entities of the same entity types b. between two similar entities of different entity types

c. between two different entities of the same entity types d. between two different entities of different entity types ANS: C 14. Which of the following is not a relationship type? a. one-to-many b. one-to-one c. one-to-few d. many-to-many ANS: C 15. Which relationship type does (1, N) mean? a. one-to-many b. one-to-one c. one-to-few d. many-to-many ANS: A 16. The cardinality constraint of a relationship relates to: a. specifying the minimum participation of one entity in the relationship b. specifying the maximum participation of one entity in the relationship c. the specification of how many occurrences of a relationship can participate in the given relationship with any one occurrence of the other relationship in the entity d. the specification of how many occurrences of an entity can participate in the given relationship with any one occurrence of the other entity in the relationship ANS: D 17. Customers of Hanson Company, a home furnishings wholesaler, place orders by contacting a sales representative via a toll-free number. Identify the constraints of the following data model relationship.

a. b. c. d.

1:1 1:N N:M N:1

ANS: B 18. The constraint that is used to specify both the minimum and maximum participation of one entity in the relationship with the other entity is called: a. cardinality constraint b. participation constraint c. economic constraint d. logical constraint ANS: B

19. Students at Macom University use an web-based course registration system. Identify the participation constraint of the following data model relationship. The university maintains student records until they graduate or do not enroll in a course for a 3-year period.

a. b. c. d.

N:M 1:N (1,1):(0,N) (1,1):(1,N)

ANS: D 20. Enterprise systems are integrated software packages designed to provide complete integration of: a. an organization's accounting information system b. an organization's business data c. an organization's business information processing systems and all related data d. an organization's management ANS: C 21. A set of data that describes an instance of the entity represented by a relation is known as a(n) ____. a. tuple b. resource c. agent d. event ANS: A 22. Legacy systems do not usually have which of the following characteristics? a. developed on previous hardware (and/or software) platforms b. are easily adaptable to enterprise systems c. have been used by an organization for a long period of time d. all of the above are typical characteristics of legacy systems ANS: B 23. In a relational database, a relation is defined as a collection of data representing multiple occurrences of the following except: a. an object b. an event c. an activity d. an agent ANS: C 24. ____ are defined as a set of data that describes an instance of the entity represented by a relation. a. Attributes b. Tuples c. Primary keys d. Candidate keys ANS: B

25. ____ specifies that for every attribute value in one relation that has been specified in order to allow reference to another relation,the tuple being referenced must remain intact. a. Cardinality constraint b. Participation constraint c. Referential integrity d. Economic constraint ANS: C 26. Which of following is not a step in the process for specifying relations based on REA diagrams? a. Determine the attributes for each of the entities. b. Determine the number of tables. c. Create a separate relational table for each entity. d. Implement the relationships among the entities. ANS: B 27. A situation in which a particular supplier provides more than one type of inventory item to a firm and a particular type of inventory item is acquired from more than a single supplier is called a(n): a. one-to-one relationship b. one-to-many relationship c. many-to-many relationship d. entity relationship ANS: C 28. The following E-R diagram shows a M:N relationship between two relations. To map this E-R diagram into a logical database model:

a. divide the content of the Course relation to establish two relations having 1:N relationships b. add the primary key of the Student relation as an attribute in the Course relation c. create a new relation whose primary key is a composite of the primary keys of two relations d. add the primary key of the Course relation as an attribute in the Student relation ANS: C 29. Which of the following is not a proper SQL command for creating database relations? a. Create table employee b. Create table training_completed c. Create client d. Alter table release_time ANS: C 30. To generate a standard report of a relational database, which of the following SQL commands would be used? a. Select report b. Select view c. Create report d. Create view

ANS: D 31. Which of the following relational commands would a manager use to combine the data from two related relations into a third relation? a. select b. project c. join d. display ANS: C 32. In a relational database, the entity is represented as a(n): a. table b. network c. field d. attribute ANS: A 33. Which is not a step in creating a relation using SQL? a. assign the relation a name b. assign each attribute a name c. specify the constraints on the attributes d. specify the attributes of the constraints ANS: D 34. Which is not an SQL command in which data can be changed in the database? a. Insert b. Delete c. Update d. Create ANS: D 35. Which of the following is a valid SQL command? a. Modify b. Insert c. Add d. Append ANS: B 36. The SELECT statement has all but one of the following parts a. a list of attributes that we wish to SELECT from the database b. a WHEN clause c. a list of tables where these attributes can be found d. a WHERE clause ANS: B The following table is a view of BILLING_HOURS from the various data elements in High-Tech Corp.'s relational database. BILLING_HOURS Employee_No Client_No Date Hours Billing_Rate

B122 A632 B122 A632 B122 A632

F26768 F11555 F26768 F11555 F26768 F11555

20010823 20010823 20010824 20010824 20010825 20010825

8 7 8 6 9 10

150 100 150 100 150 100

37. Which of the following SQL statements would extract the employee number and date for every instance that an employee worked more than 8 hours any particular day? a. SELECT Employee_No, Date FROM BILLING_HOURS WHERE Hours>8 b. QUERY Employee_No, Date FROM BILLING_HOURS WHERE Hours>8 c. SELECT Employee_No, Date WHERE Hours>8 d. QUERY BILLING_HOURS SELECT Employee_No, Date WHERE Hours>8 ANS: A 38. Which of the following SQL statements would extract the employee number and date for every instance that an had a billing rate of $150? a. SELECT Employee_No, Date FROM BILLING_HOURS WHERE Rate=150 b. QUERY Employee_No, Date FROM BILLING_HOURS WHERE Rate=150 c. SELECT Employee_No, Date WHERE Rate=150 d. QUERY BILLING_HOURS SELECT Employee_No, Date WHERE Hours>8 ANS: A 39. Which of the following SQL statements would extract the client number and date for every instance that an had a billing rate of $150? a. QUERY BILLING_HOURS SELECT Client_No, Date WHERE Rate=150 b. QUERY client_No, Date FROM BILLING_HOURS WHERE Rate=150 c. SELECT Client_No, Date WHERE Rate=150 d. SELECT Client_No, Date FROM BILLING_HOURS WHERE Rate=150 ANS: D

40. Which of the following SQL statements would extract the client number and date for every instance that an employee worked less than 8 hours any particular day? a. QUERY BILLING_HOURS SELECT Client_No, Date WHERE Hours<8 b. QUERY client_No, Date FROM BILLING_HOURS WHERE Hours>8 c. SELECT Client_No, Date WHERE Hours<8 d. SELECT Client_No, Date FROM BILLING_HOURS WHERE Hours<8 ANS: D COMPLETION 1. A(n) ____________________ in an accounting system can be classified as a resource, event, agent, or location. ANS: entity 2. A(n) ____________________ is an item of data that characterizes an entity or relationship. ANS: attribute 3. Attributes that consist of multiple subattributes are referred to as _________________________. ANS: composite attributes 4. A(n) _________________________ is the attribute whose value is unique for every entity that will appear in the database. ANS: key attribute 5. ____________________ define and map the way in which data can be extracted from a database in the future. ANS: Relationships 6. A(n) ______________________________ is a relationship between two different instances of an entity. ANS: recursive relationship 7. The relationship that relates to the specification of how many occurrences of an entity can participate in the given relationship with any one occurrence of the other entity in the relationship is referred to as ______________________________. ANS: cardinality constraint

8. The ______________________________ is used to specify both the minimum and maximum participation of one entity in the relationship with the other entity. ANS: participation constraint 9. The notation 1,N is used to specify the relationship type of _________________________. ANS: one to many 10. REA stands for ____________________, ____________________, and ____________________. ANS: resources, events, agents 11. __________________________________________________ are integrated software packages designed to provide complete integration of an organization's business information processing systems and all related data. ANS: Enterprise resource planning systems ERP systems 12. A collection of data representing multiple occurrences of a resource, event, or agent is known as a(n) ____________________. ANS: relation 13. A set of data that describes an instance of the entity represented by a relation is known as a(n) ____________________. ANS: tuple 14. The _________________________ is specified to identity each tuple in the relation. ANS: primary key 15. ___________________________________ specifies that for every attribute in one relation that has been specified to allow reference to another relation, the tuple being referenced must be intact. ANS: Referential integrity 16. ____________________ is a powerful database language that can be used to define database systems, query the database for information, generate reports from the database, and access databases from within programs using embedded commands. ANS: SQL 17. The ____________________ command is used to add a single tuple to an existing relation. ANS: INSERT insert 18. The ____________________ command demonstrates one of the weaknesses in most forms of SQL.

ANS: DELETE delete 19. The ____________________ command is used when we want to change one or more attribute values. ANS: UPDATE update 20. Queries of a database are driven by ____________________ commands. ANS: SELECT select PROBLEM 1. The following table is a view of BILLING_HOURS from the various data elements in ABC's relational database: BILLING_HOURS Employee_No B122 A632 B122 A632 B122 A632 B122 A632 A356 A432 A491 B122 A632 A356 B432 B491 Client_No F11555 F11555 F11555 F11555 F11555 F11555 H12456 H12456 F11555 H12456 H12456 F11555 H12456 F11555 H12456 H12456 Date 990823 990823 990824 990824 990825 990825 990826 990826 990826 990826 990826 990827 990827 990827 990827 990827 Hours 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 Billing_Rate 150 100 150 100 150 100 150 100 57 57 57 150 100 57 57 57

Required: a. Using proper SQL commands, develop a query to extract billing data for Fleet Services (client number F11555), showing the employee number, date, hours, and billing rate. Design a table showing the output that would be generated based upon your query created above.

b.

ANS: a. SELECT FROM

Employee_No, Date, Hours, Billing_Rate BILLING_HOURS

WHERE b. Employee_No B122 A632 B122 A632 B122 A632 A356 B122 A356

Client_No='F11555'

Date 990823 990823 990824 990824 990825 990825 990826 990827 990827

Hours 8 8 8 8 8 8 8 8 8

Billing_Rate 150.00 100.00 150.00 100.00 150.00 100.00 57.00 150.00 57.00

2. The following table is a view of TRAINING_COMPLETED from the various data elements in HighTech Corp.'s relational database: TRAINING_COMPLETED Employee_No 11111 11152 11163 11111 11152 11163 11111 11152 11175 11111 11175 11111 11152 11163 11175 Date 990823 990823 990823 990824 990824 990824 990825 990825 990825 990826 990826 990827 990827 990827 990827 Hours 8 8 8 8 8 8 8 8 8 8 8 8 8 8 8 Train_Code 15 15 45 25 25 15 45 55 45 55 55 65 45 65 65

Required: a. Using proper SQL commands, develop a query to extract training data for employee Missy Pitman (employee number 11111), showing the date, hours, and training code. Design a table showing the output that would be generated based upon your query created above.

b.

ANS: a. SELECT FROM WHERE b. Date 990823

Date, Hours, Train_Code TRAINING_COMPLETED Employee_No='11111'

Hours 8

Train_Code 15

990824 990825 990826 990827

8 8 8 8

25 45 55 65

3. Based on the following abbreviated description of Avery University's course scheduling and student advising procedures, prepare an Entity-Relationship (E-R) diagram that reflects the key entities and relationships. Course Scheduling: In consultation with the vice-president of Academic Affairs and the Registrar's Office, each academic department chair decides which courses will be offered each semester and how many sections of each course will be scheduled. Courses are scheduled in sections meeting at different times over the course of the week. Some courses are scheduled in multiple sections. The department chair also assigns a faculty member who teaches for his/her department to teach each course-section. Students enroll in courses-sections by submitting their schedule selections to the Registrar's Office. In assigning students to sections, the Registrar gives preference to students based on their class standing (i.e., Senior, Junior, Sophomore, and Freshman). Student Advising: Student academic advising is done according to each student's major. Each student chooses a faculty advisor from his/her major department. While each student has only one "official" academic advisor, each faculty person advises several students, up to a maximum of 15 advisees. ANS: See Figure TB-5.1.

S-ar putea să vă placă și