# Chapter 1: Introduction to Database * #### (D) 1. Which of the following types of data can be stored in a database? (A) Letters (B) Video (C) Numbers (D) All of the above * #### (C\) 2. Which is false? (A) A database is a collection of related data. (B) Data are known facts that can be recorded and have an implicit meaning. (C) Meta-data are the status of data. (D) None of the above. * #### (A) 3. Data after processing are called ____. (A) information (B) meta-data (C) entity (D) catalog * #### (D) 4. Which is not a function of DBMS? (A) Define a particular database in terms of its data types, structures, and constraints. (B) Construct or Load the initial database contents on a secondary storage medium. (C) Manipulate the database. (D) Process the system command. * #### (C\) 5. Which is not database manipulation? (A)Retrieval (B) Modification (C) Loading a database into DBMS (D) Accessing the database through Web applications * #### (B) 6. ___ includes insertions, deletions and updates to the content of a database. (A) Retrieval (B) Modification (C) Accessing (D) Specification * #### (D) 7. Which is not a characteristics of the database approach? (A) Self-describing nature of a database system (B) Insulation between programs and data (C) Data Abstraction (D) Support of a single view of the data * #### (A) 8. Database ____ stores the description of a particular database (A) catalog (B) constraint (C) view (D) transaction * #### (B) 9. Who is responsible to define the content, the structure, the constraints, and functions or transactions against the database? (A) Database administrators (B) Database designers (C) Application programmer (D) none of the above * #### (D) 10. Which of the following is an advantage of database systems? (A) Controlling redundancy in data storage (B) Restricting unauthorized access to data (C) Providing indexes (D) all of the above * #### (A) 11. Which of the following is not an advantage of database systems? (A) Redundant data (B) Better data quality (C) Reduced program maintenance (D) Program-data independence * #### (D) 12. When is a DBMS used? (A) High costs of using a DBMS (B) When a DBMS may be unnecessary (C) When no DBMS may suffice (D) none of the above * #### (A) 13. A data warehouse derives its data from: (A) various operational data sources (B) reports (C) a data market (D) on-line transactions * #### (C\) 14. ____ is not a DBMS. (A) MySQL (B) DB2 (C) Microsoft Word (D) PostgreSQL # :memo: Chapter 2: Overview of Database Languages and Architectures * #### (C\) 1. ___ is a set of concepts to describe the structure of a database, the operations for manipulating these structures, and certain constraints that the database should obey. (A) data type (B) data set (C) data model (D) data package * #### (B) 2. Database _____ are used for specifying database retrievals and updates by referring to the constructs of the data model. (A) structures (B) operations (C) constraints (D) entity * #### (C\) 3. Database _____ are used to specify some restrictions on valid data. (A) structures (B) operations (C) constraints (D) entity * #### (B) 4. Which is not a category of data model? (A) conceptual (B) application (C) physical (D) implementation * #### (A) 5. ____ data models provide concepts that are close to the way many users perceive data. (A) conceptual (B) application (C) physical (D) implementation * #### (D) 6. ____ is the description of a database. (A) database instance (B) database construction (C) database query (D) database schema * #### (C\) 7. ____ is the actual data stored in a database at a particular moment in time. (A) database query (B) database construction (C) database state (D) database schema * #### (A) 8. Which is true? (A) A valid state is a state that satisfies the structure and constraints of the database. (B) The database state changes very infrequently. (C) Schema is also called extension. (D) None of the above * #### (A) 9. Which is not a level of DBMS schemas? (A) Application (B) Internal (C) Conceptual (D) External schemas * #### (B) 10. A logical description of some portion of the database is a(n) ____ view. (A) internal (B) user (C) conceptual (D) implementation * #### (D) 11. ____ schema at the internal level to describe physical storage structures and access paths. (A) implementation (B) external (C) conceptual (D) internal * #### (D) 12. ____ among schema levels is needed to transform requests and data. (A) Query (B) Retrieval (C) Instances (D) Mapping * #### (C\) 13. ____ is used to specify database retrievals and updates? (A) SDL (B) DDL (C) DML (D) UML * #### (C\) 14. Languages, menus, and other facilities by which users interact with the database are collectively called a(n) ____ (A) client. (B) icon. (C) user interface. (D) development environment. * #### (D) 15. Which is not an approach of DBMS programming language interfaces? (A) Embedded (B) Procedure call (C) Database programming language (D) Dynamic linking * #### (A) 16. Which is not a type of DBMS interfaces? (A) file (B) menu-based (C) Web browser (D) natural language * #### (C\) 17. Data ____ is used to store schema descriptions and other information. (A) constraint (B) operation (C) repository (D) query * #### (C\) 18. CASE is a class of tools that: (A) provides guidelines for the physical design of a database. (B) assists the database administrator in maintaining a database. (C) automates the design of databases and application programs. (D) provides management reporting tools. * #### (B) 19. A workgroup database is stored on a central device called a(n): (A) client. (B) server. (C) network. (D) remote PC. * #### (B) 20. Which stores the business logic part of the application? (A) client (B) application server (C) database server (D) interface * #### (C\) 21. The user interface is managed by the: (A) database tier. (B) client tier. (C) application tier. (D) lower tier. * #### (B) 22. Which is not a type of data models? (A) network model (B) star model (C) hierarchical Model (D) relational model * #### (B) 23. Which is an advantage of the hierarchical model? (A) Navigational and procedural nature of processing. (B) Simple to construct and operate. (C) Database is visualized as a linear arrangement of records. (D) There is little scope for "query optimization" * #### (C\) 24. Who created the relational mode? (A) Peter Chen (B) C. J. Date (C) E. F. Codd (D) None of the above # :memo: Chapter 3: The Basic (Flat) Relational Model * #### (B) 1. What does the strength of the relational approach to data management comes from? (A) higher adaptability and productivity. (B) the formal foundation provided by the theory of relations. (C) better concurrency control. (D) ease of conversion to any new approach. * #### (A) 2. What mathematical concept is a relation based on? (A) set (B) vector (C) difference (D) matrix * #### (C\) 3. Who first proposed the relation model? (A) Peter Chen (B) C. J. Date (C) E. F. Codd (D) None of the above * #### (D) 4. Which is false? (A) A relation looks like a table of values. (B) A relation typically contains a set of rows. (C) In a relation rows are called tuples. (D) Each row has a row header called an attribute. * #### (D) 5. In each row a value of a data item (or set of items) that uniquely identifies that row in the table is called ____. (A) tuple (B) set (C) column (D) attribute * #### (A) 6. The key that is generated by the DBMS is called ____ key. (A) artificial (B) automatic (C) automic (D) access * #### (C\) 7. The attribute ____ is the set of values allowed in an attribute. (A) schema (B) state (C) domain (D) scope * #### (B) 8. A subset of the Cartesian product of the domains of its attributes is relation ____. (A) schema (B) state (C) domain (D) scope * #### (D) 9. Which is false? (A) All values in a tuple are considered atomic. (B) Each value in a tuple must be from the domain of the attribute for that column. (C) A special null value is used to represent values that are unknown or inapplicable to certain tuples. (D) The tuples are considered to be ordered. * #### (C\) 10. Which is not a constraint in the relational model? (A) Key (B) Entity integrity (C) Value (D) Referential integrity * #### (B) 11. Which is not condition a superkey should satisfy? (A) No two tuples in any valid relation state will have the same value for superkey. (B) A superkey should be minimal. (C) This condition must hold in any valid relational state. (D) For any distinct tuples the values of superkey are different. * #### (A) 12. Which is false? (A) A relation can have only one key. (B) A key is a minimal superkey. (C) Any key is a superkey. (D) Any set of attributes that includes a key is a superkey. * #### (A) 13. Which is entity integrity? (A) The primary key cannot have null values. (B) A relation can have only one key. (C) If the key values are different, two tuples are different. (D) Any key is a superkey. * #### (A) 14. A foreign key is (A) a key that references a primary key in other relation. (B) a key that cannot be null. (C) a key that uniquely identifies different tuples. (D) a superkey. * #### (C\) 15. Which constraint involves two relations? (A) Key constraint (B) Entity integrity (C) Referential integrity (D) Domain constraint * #### (D) 16. Which of the following is the action can be taken in case of integrity violation? (A) Cancel the operation that causes the violation. (B) Perform the operation but inform the user of the violation. (C) Trigger additional updates so the violation is corrected. (D) All of the above * #### (A) 17. Which type of solutions to integrity violation does restrict or reject belong to? (A) Cancel the operation that causes the violation. (B) Perform the operation but inform the user of the violation. (C) Trigger additional updates so the violation is corrected. (D) Execute a user-specified error-correction routine. * #### (D) 18. Which constraint may insert violate? (A) Domain constraint (B) Key constraint (C) Referential integrity (D) All of the above * #### (C\) 19. Which constraint may delete violate? (A) Domain constraint (B) Key constraint (C) Referential integrity (D) All of the above * #### (D) 20. Which constraint may update violate? (A) Domain constraint (B) Key constraint (C) Referential integrity (D) All of the above # :memo: Chapter 4: SQL: Data Definition, Constraints, and Basic Queries and Updates * #### (B) 1. What does SQL stand for? (A) Standard Query Language (B) Structured Query Language (C) Semantic Query Language (D) Syntax Query Language * #### (D) 2. Which is not a category of SQL? (A) DDL (B) DML (C) DCL (D) DAL * #### (C\) 3. Which is not a SQL command? (A) delete (B) insert (C) search (D) update * #### (D) 4. Which is not a DDL command? (A) alter table (B) create table (C) drop table (D) select table * #### (B) 5. Which is not a DML command? (A) delete (B) drop table (C) insert (D) update * #### (A) 6. Which of the following is to use alter a table? (A) DDL (B) DML (C) DCL (D) DAL * #### (B) 7. Which of the following is to use update a table? (A) DDL (B) DML (C) DCL (D) DAL * #### (B) 8. Which is a set of commands used to update and query a database? (A) DDL (B) DML (C) DCL (D) DAL * #### (B) 9. Which of the following is not a DML command? (A) insert (B) create table (C) delete (D) select * #### (C\) 10. To delete a table, which SQL command can be used? (A) delete (B) unpack (C) drop (D) truncate * #### (C\) 11. How many attributes will be shown in the following query? select student_no, name, department, address, email (A) 3 (B) 4 (C) 5 (D) 6 * #### (A) 12. In select student_no, score from the grade_report table where course_no = 'CS02208', what is course_no = 'CS02208'? (A) A condition (B) A list of attribute names (C) A list of the relation names (D) None of the above * #### (B) 13. What result set will the following query return? select item_no from order where quantity > 20; (A) The order_id of all orders that had more than 20 items. (B) The item_no of all orders that had more than 20 items. (C) The order_id of all orders that had more than one item. (D) The item_no of all orders that had 20 or more items. * #### (D) 14. Which can be used to select the student's number whose score is greater than or equal to 60 from the grade_report table? (A) select student_no from report where score <= 60. (B) select student_no from report where score > 60 (C) select student_name from grade_report where score >= 60. (D) select student_no from grade_report where score >= 60 * #### (A) 15. To eliminate duplicate rows in a query, the ________ qualifier is used in the SQL Select command. (A) distinct (B) check (C) alter (D) specific * #### (D) 16. The SQL command ________ adds one or more new columns to a table. (A) create relationship (B) create view (C) create table (D) alter table * #### (D) 17. Indexes are created in most RDBMSs to: (A) provide a quicker way to store data. (B) decrease the amount of disk space utilized. (C) increase the cost of implementation. (D) provide rapid random and sequential access to base-table data. * #### (B) 18. What result set will the following query return? select item_no, description from item where price >= 100 and price <= 200; (A) The item_no for all items costing between 100 and 200 (B) The item_no and description for all items costing between 100 and 200 (C) The item_no and description for all items costing less than 100 (D) The item_no and description for all items costing more than 200 * #### (A) 19. In an SQL statement, which of the following parts states the conditions for row selection? (A) where (B) select (C) from (D) in case * #### (B) 20. What does the following SQL statement do? delete from customer where city = 'Hsinchu'; (A) Deletes all records from the customer table. (B) Deletes all records from customer where the city is equal to Hsinchu. (C) Removes the customer table from the database. (D) None of the above * #### (B) 21. DDL is typically used during which phases of the development process? (A) Analysis (B) Physical design (C) Implementation (D) All of the above * #### (A) 22. Which of the following is the wildcard operator in SQL statements? (A) * (B) <> (C) = (D) & * #### (B) 23. Which is a aggregate function that returns the number of tuples or values as specified in a query? (A) avg (B) count (C) min (D) sum * #### (C\) 24. Which provides a condition on the group of tuples associated with each value of the grouping attributes? (A) exit (B) in (C) having (D) with * #### (B) 25. Which can be used to increase the 10% interest rate for all accounts in the account table? (A) update account where interest = 0.1; (B) update account set interest = 1.1 * interest; (C) udpate interest * 1.1 from account (D) None of the above # :memo: 問答題 * #### Briefly explain these terminologies. If they are acronyms, also write what they stand for. 1. database 2. database system 3. DBA 4. meta-data 5. data mining 6. data independence 7. DDL 8. DML 9. JDBC 10. ODBC 11. XML 12. UML 13. tuple 14. domain 15. semantic integrity 16. integrity constraint 17. What does SQL stand for? 18. ODBC :::spoiler :star: **解答** 1. database:用來儲存和組織大量資料的系統。 2. database system:包括資料庫、資料庫管理系統和應用程式,負責處理資料庫中的資料和相關的操作。 3. 資料庫管理員(DBA)Database Administrator:負責管理資料庫系統。 4. meta-data:data about data。 5. data mining:利用統計學、人工智慧和機器學習等技術,從大量資料中發現隱藏的模式和知識。 6. data independence:指資料庫中的資料可以獨立於應用程式和硬體的改變而存在,包括物理獨立性和邏輯獨立性。 7. DDL(Data Definition Language):用於創建、修改和刪除資料庫中的物件,包括表格、視圖和索引等。 8. DML(Data Manipulation Language):用於對資料庫中的資料進行查詢、新增、修改和刪除等操作。 9. JDBC(Java Database Connectivity):Java語言中操作關聯式資料庫的標準API。 10. ODBC(Open Database Connectivity):是一個跨平台的API,用於訪問各種資料庫系統。 11. XML(Extensible Markup Language):可延伸標記語言,用於在不同系統之間傳遞和儲存資料。 12. UML(Unified Modeling Language):統一建模語言,用於軟體系統設計和開發中的規範化和圖形化表示。 13. tuple:資料庫中表格的一行,包含多個欄位。 14. domain:資料庫中欄位所定義的資料範圍和限制。 15. semantic integrity:指資料庫中的資料必須符合既定的語義和約束條件。 16. 完整性約束是指在資料庫中維持數據的一致性和有效性所需遵守的規則或條件。 17. SQL是Structured Query Language(結構化查詢語言)的縮寫,是一種用於與關聯式資料庫系統進行通訊和管理的標準語言。通過SQL,可以創建、查詢、修改和刪除資料庫中的數據,並授權或撤銷對資料庫的訪問權限。 ::: * #### 1. What is data model? <br/>2. Explain the main categories of data models. :::spoiler :star: **解答** 1. data model:資料模型是描述資料庫中資料結構、特性和關係的方式。 2. categories of data models: 1. 物理資料模型:如何儲存在硬體上的實現方式,例如表格、索引、關聯等。 2. 概念資料模型:實體、屬性和實體之間的關係,通常使用實體關係模型(ER 模型)來表示。 3. 邏輯資料模型:描述了資料庫中資料的邏輯結構,即資料的組織方式和操作,例如關聯式資料模型(RDBMS)和非關聯式資料模型(NoSQL)。 :::