Module 2 Flashcards
The following table, OrderLine, represents a single line item on a grocery store receipt. OrderID is the identifier for the entire order. OrderLineNumber is the number of an entry on your receipt, such as 1 for the first line on the receipt, and 2 for the second line on the receipt. Select all statements that are true about this table.
A) There can be multiple different products in a row of the OrderLine table.
B) OrderID would make a good primary key.
C) ProductID could be a foreign key linked to a Product table.
D) Any attribute in this table would be a good choice as the primary key.
C)
Yes. The only information is the ID number, so it’s likely it’s linked to a Product table that contains more information about the product,
such as its name.
Which of the following are true about SELECT command?
A) The GROUP BY clause in a SELECT command groups tables with matching columns.
B) The WHERE clause can be used to see if a field is empty.
C) The SELECT command has several optional clauses, including the WHERE clause.
D) The WHERE clause of a SELECT command can be used to compare different values so you can limit the result set.
B) C) D)
Yes, the WHERE clause can be used to see if a field is empty, i.e. check for nulls.
Yes. The WHERE clause is optional in the SELECT command.
Yes. One of the purposes of the WHERE clause is to compare the value of a #eld to a di”erent value or constant. The WHERE clause condition will limit the result set of a query so only records that match the WHERE clause condition are displayed.
Which of these statements are true about the SQL language?
A) The SQL language is only supported by a few RDBMS products.
B) REVOKE is a valid SQL command.
C) The SQL language includes the Data Definition Lanaguage (DDL) which is used to create tables and other database objects.
D) SQL has been around for many years and the acronym SQL is short for “Structured inQuery Language”.
E) PL/SQL is slowly replacing SQL as it is much more powerful.
B) C)
Yes, REVOKE is a valid SQL command.
Yes, DDL includes the CREATE, DROP, and ALTER commands, which are used to create, delete, and change database objects.
While SQL has indeed been around for many years, the SQL Feedback: acronym stands for Structured Query Language.
How does a DBMS provide data recovery?
A) The RDBMS has a backup mechanism that can be used for data recovery if needed.
B) Data changes are recorded in logs as they are made.
C) Users can make backups or copies of a database.
D) Indexes are used by a DBMS to aid in the data recovery process.
A) B)
The DBMS permits administrators to create backups of the database.
The DBMS splits updates into individual transactions, uses the individual transactions to modify the data, and maintains a log of these transactions.
The RDBMS permits administrators to create backups of the database. Users don’t have rights to do this operation.
Which of the following statements correctly describe databases in an organization?
A) Over the past two decades, object oriented databases have prevailed as the leading model for databases.
B) Today many organizations use IT activities such as data mining to streamline their operations and achieve competitive advantages.
C) A database is inherently secure so extra security measures are not necessary for databases.
D) Databases are becoming obsolete in organizations as new technology takes their place.
B)
Which of these statements are true about relational databases?
A) A primary key uniquely identifies a row in a table.
B) A modern standard RDBMS stores metadata about the database, such as names and data types, in a special part of the database called the system catalog.
C) Tables in RDBMS represent only business entities such as customers or products.
D) Attributes in an RDBMS table correspond to rows in a spreadsheet such as Excel.
A) B)
Yes. Some features of of object-oriented models., such as specialization-generalization and references, are so useful that they have been added to RDBMS products such as Oracle, and the recent ANSI and ISO standards are object-relational.
Answer Yes. Any changes that are made to the data definitions and their relationships are automatically recorded in the system catalog.
Which of the following statements regarding an RDBMS and a spreadsheet application are true?
A) An RDBMS supports indexes to quickly find requested data items, while a spreadsheet does not.
B) An RDBMS requires an additional statement to save the updates, while a spreadsheet saves changes instantly.
C) Both an RDBMS and spreadsheets support referential integrity.
D) A spreadsheet organizes data into rows and columns, whereas an RDBMS does not.
A)
Yes. An RDBMS can support indexes based on a key. A spreadsheet application does not have this ability.
No. An RDBMS may or may not require an additional statement (COMMIT) to save the changes to the data, but a spreadsheet requires you to save the workbook or the data changes will be lost.
Which of the following are true about the DELETE command?
A) The DELETE command can delete part of a record and leave the rest of the record intact.
B) It can be difficult to recover data deleted by the DELETE command.
C) The DELETE command deletes both the table and the data in that table.
D) The DELETE command will not make any changes to the table if the WHERE clause is missing.
E) The DELETE command allows you to specify a condition so that only certain data is deleted from the table when the command is issued.
B) E)
What is true about a composite key?
A) It is a primary key and a foreign key combined.
B) It is two or more attributes in one table that are combined to form a key.
C) It is a key made of two different data types.
D) When a composite primary key is defined, multiple attributes together uniquely identify each record.
B) D)
Yes. This is the definition of a composite key.
Answer The definition of a composite primary key is two or more attributes which together uniquely determine (or identify) a record.
Which of the following statements are true regarding keys?
A) Each row in a table must have a different value for the primary key.
B) A table can have no key, one key or several keys.
C) Relationships are created through the use of primary keys.
D) Relationships are created through the use of foreign keys.
A) B) D)
Which of the following are true about data control language (DCL)?
A) To set up referential integrity, you would use DCL commands.
B) DCL commands are part of the way an RDBMS handles security.
C) DCL commands include GRANT and REVOKE.
D) DCL commands include INSERT, UPDATE, and DELETE.
B) C)
Yes. DCL commands specify who can access data in the database and which operations they can perform.
Yes. DCL commands include GRANT and REVOKE.
Which of the following are true about DDL commands?
A) DDL commands are part of the SQL language.
B) DDL commands are used to create and modify table structures.
C) DDL commands include CREATE, UPDATE and ALTER.
D) DDL commands can only be issued when the database is first created.
A) B)
Yes. The SQL language consists of a data description language (DDL), a data manipulation language (DML) and a data control language (DCL).
Yes. The DDL commands are used to create and modify table structures.
Which of the following are true about the ALTER TABLE command?
A) The ALTER TABLE command allows you to delete a column from a table based on a condition in the WHERE clause of the command.
B) ALTER TABLE command allows you to add a constraint to an existing table.
C) The ALTER TABLE command allows you to modify the data type of a column in an existing table.
D) The ALTER TABLE command allows you to add a new column to an existing table.
E) The ALTER TABLE command allows you to change data in a record after it has been inserted.
B) C) D)
Which of the following are true about programming for databases?
A) Database programming can be useful for extending security in a database application.
B) Most RDBMS include a programming language that allows the programmer to execute SQL commands integrated with conventional programming constructs.
C) A database program can be useful for loading a data warehouse.
D) A database programmer can write code that will execute different commands based on different conditions.
A) B) C) D)
Yes. This is one of the purposes of a database program.
Yes. This is one of the uses of a database program.
Yes. It is possible to use conditional clauses in database programming. A conditional clause might depend on the values of different data items. For instance, you might have a program that says if the student is an online student, set the value of the classroom attribute to “Online”, but if the student is not an online student, set the value of the classroom attribute to a room number.
Select all statements that are true about data types in SQL RDBMS.
A) The VARCHAR data type can store strings of characters of varying lengths, such as might occur for people’s names.
B) Modern SQL DBMS support data types that store dates and times.
C) Each row has a specific data type.
D) The number 6.25 could be stored in a variable of type INTEGER.
A) B)
Yes. A CHAR data type stores a fixed length of characters. The VARCHAR data type stores a variable length of characters.
Answer Yes. There are specific data types for date and time, including the stand.