DBMG Midterm

Lakukan tugas rumah & ujian kamu dengan baik sekarang menggunakan Quizwiz!

Which of the following is the wildcard operator in SQL statements?

*

Which of the following is a wildcard operator in SQL statements?

*A. ** B. & C. < > D. =

The first part of an SQL query to be read is the ________ statement.

*A. FROM* B. WHERE C. ORDER BY D. SELECT

To get all the customers from Hawaii sorted together, which of the following would be used?

*A. ORDER BY* B. HAVING C. GROUP BY D. SORT

What will result from the following SQL Select statement? Select min(Product_Description) from Product_V;

*A. The first product description alphabetically in Product_V will be shown.* B. An error message will be generated. C. SELECT @ will be displayed. D. The minimum value of Product_Description will be displayed.

Organizing Data to get information

1. Lists / Single Table 2. Databases Hierarchical Network Relational Object-Oriented

functional dependency

A constraint between two attributes is called a(n): A) functional relation. B) attribute dependency. C) functional dependency. D) functional relation constraint

integrity constraints.

A domain definition consists of all of the following components EXCEPT: A) domain name. B) data type. C) integrity constraints. D) size.

security specifications

A form of database specification which maps conceptual requirements is called: A) logical specifications. B) response specifications. C) security specifications. D) physical specifications

descriptor

A nonkey attribute is also called a(n): A) column. B) unimportant datum. C) descriptor. D) address.

attributes. (2)

A person's name, birthday, and social security number

Composite Key

A primary key that consists of MORE THAN ONE ATTRIBUTE IS CALLED A: A) foreign key. B) composite key. C) multivalued key. D) cardinal key.

Enterprise Key

A primary key whose value is unique across all relations is called a(n): A) global primary key. B) inter-table primary key. C) enterprise key. D) foreign global key

attribute

A property or characteristic of an entity type that is of interest to the organization.

subquery

A type of query that is placed within a WHERE or HAVING clause of another query.

What will be returned when the following SQL statement is executed? Select driver_no, count(*) as num_deliveries from deliveries where state = 'MA' group by driver_no;

A. A listing of all drivers who made deliveries to state = 'MA', sorted by driver number *B. A listing of each driver who made deliveries to state = 'MA' as well as the number of deliveries that each driver has made to that state* C. An error message will be generated D. A count of all of the deliveries made to state = 'MA' by all drivers

What does the following SQL statement do? Update Product_T Set Unit_Price = 775 Where Product_ID = 7

A. Changes the length of the Unit_Price field to 775 B. Updates the Product_T table to have a unit price of 775 C. Changes the price of a unit called Product_T to 7 *D. Changes the unit price of Product 7 to 775*

alter table

Adds one or more new columns to a table.

Table

Also called a relation. Represents a concept within the database

Column

Also called attributes, fields, or values Store single piece of information (Phone #)

Row

Also called records or tuples (rarely) Series of values (columns) Every record has an identical structure Each record represents a single entity

History of Databases- 2000s

Although the Internet industry experienced a decline in the early 2000s, database applications continue to grow. New interactive applications were developed for PDAs, point-of-sale transactions, and consolidation of vendors. Presently, the three leading database companies in the western world are Microsoft, IBM, and Oracle.

alias.

An alternative name for an attribute is called a(n): A) synonym. B) alias. C) alternate attribute. D) related characteristic

primary key

An attribute (or attributes) that uniquely identifies each row in a relation is called a: A) column. B) foreign field. C) primary key. D) duplicate key.

drop

Any create command may be reversed

What will be returned when the following SQL statement is executed? Select driver_no,count(*) as num_deliveries from deliveries group by driver_no; A) A listing of all drivers, sorted by driver number B) A listing of each driver as well as the number of deliveries that he or she has made C) A count of all of the deliveries made by all drivers D) None of the above

B

All of the following are new data types added in SQL:2008 EXCEPT:

BIT.

UNION-compatible

Both output compatible data types for each column and return the same number of rows.

Where are Databases used?

Businesses: Inventory Accounting Technical data; i.e. location databases Customer information

What does the following SQL statement do? Alter Table Customer_T Add (Type Varchar (2)); A) Alters the Customer_T table to accept Type 2 Varchars B) Alters the Customer_T table to be a Type 2 Varchar C) Alters the Customer_T table, and adds a field called "Type" D) Alters the Customer_T table by adding a 2-byte field called "Varchar"

C

join operation

Causes two tables with a common domain to be combined into a single table or view.

Unique Keys

Composite Key: Composed of two or more attributes (i.e. name and phone number) Primary Key: Candidate key chosen to be the main identifier for the relation Candidate Key: Potential to become the primary key Surrogate Key: Added to a relation to serve as the primary key (i.e. Enrollment ID) Usually a number, have no meaning to users Often used in place of a composite primary key

Cookies

Cookies are saved by your browser as a general (but non specific) form of tracking. Cookies effectively track your internet activity. Notice how after you search for specific terms like "buy watches", all of a sudden Facebook starts serving you with ads from online watch stores? When you attempt to access Facebook, your cookies are routed with your request to Facebook's webserver. Using a backend API, Facebook is able to view subjects you've recently looked at, in turn personalizing an ad specifically targeted at you.

The benefits of a standardized relational language include: A) application longevity. B) reduced training costs. C) cross-system communication. D) all of the above.

D

Which of the following is a purpose of the SQL standard? A) To specify syntax and semantics of SQL data definition and manipulation B) To specify minimal and complete standards, which permit different degrees of adoption in products C) To define the data structures and basic operations for SQL databases D) All of the above

D

________ is a set of commands used to update and query a database.

DML

Tables

Data is represented in the form of: A) data trees. B) tables. C) data notes. D) chairs.

True

Data structures include data organized in the form of tables with rows and columns. T / F

create view

Defines a logical table from one or more tables or views.

The main concept of relational databases was published in 1970 by:

E.F.Codd.

In order to embed SQL inside of another language, the ________ statement must be placed before the SQL in the host language.

EXEC SQL

________ takes a value of TRUE if a subquery returns an intermediate results table which contains one or more rows.

EXISTS

6SQL originated from a project called System-S.

FALSE

A catalog is the structure that contains object descriptions created by a user.

FALSE

A database is maintained and queried using the data mapping language (DML).

FALSE

A function has only input parameters but can return multiple values.

FALSE

A referential integrity constraint specifies that the existence of an attribute in one table depends upon the existence of a foreign key in the same or another table.

FALSE

A routine is a named set of SQL statements that are considered when a data modification occurs.

FALSE

A single value returned from an SQL query that includes an aggregate function is called a vector aggregate.

FALSE

A subquery in which processing the inner query depends on data from the outer query is called a codependent query.

FALSE

An equi-join is a join in which one of the duplicate columns is eliminated in the result table.

FALSE

Combining a table with itself results in a faster query.

FALSE

Count(*) tallies only those rows that contain a value, while Count counts all rows.

FALSE

DBA_USERS contains comments on all tables in an Oracle database.

FALSE

DCL is used to update the database with new records.

FALSE

EXISTS takes a value of false if the subquery returns an intermediate result set.

FALSE

IF-THEN-ELSE logical processing cannot be accomplished within an SQL statement.

FALSE

Implementation of a standard can never stifle creativity and innovation.

FALSE

In databases, null values are equivalent to zero.

FALSE

The DELETE TABLE DDL command is used to remove a table from the database.

FALSE

The first part of an SQL query to be read is the ________ statement.

FROM

A catalog is the structure that contains object descriptions created by a user.

False

A database is maintained and queried using the data mapping language (DML).

False

A referential integrity constraint specifies that the existence of an attribute in one table depends upon the existence of a foreign key in the same or another table.

False

A single value returned from an SQL query that includes an aggregate function is called a vector aggregate.

False

Count(*) tallies only those rows that contain a value, while Count counts all rows.

False

DCL is used to update the database with new records.

False

SQL originated from a project called System-S.

False

The CREATE SCHEMA DDL command is used to create a table.

False

Non-Unique Keys

Foreign Key: Used to establish relationships Primary Key from one table that is placed into another table Becomes a foreign key in the table that receives the key

Which of the following can produce scalar and vector aggregates?

GROUP BY

TRUE.

In the figure below, each employee has exactly one manager. Answer : T / F

COMPOSITE

In the figure below, the primary key for "Order Line" is which type of key? A) Composite B) Foreign C) Standard D) Grouped

Recursive foreign

In the figure below, what type of key is depicted? A) Primary B) Recursive primary C) Composite D) Recursive foreign

________ differs from array because it can contain duplicates.

MULTISET

a strong entity depends

None of the above

A new set of analytical functions added in SQL:2008 is referred to as:

OLAP functions.

Extensions defined in SQL-99 that include the capability to create and drop modules of code stored in the database schema across user sessions are called:

Persistent Stored Modules.

DDL is typically used during which phase of the development process?

Physical design

Referential Integrity Constraints are generally established between:

Primary and Foreign keys.

Indexes

Provide rapid random and sequential access to base-table data.

What does the following SQL statement do? Select * From Customer Where Cust_Type = "Best"

Selects all the fields from the Customer table for each row with a customer labeled "Best"

Relational databases are heavily based on the mathematical concept of:

Set Theory.

Where

States the conditions for row selection

A correlated subquery is executed once for each iteration through the outer loop.

TRUE

A database table is defined using the data definition language (DDL).

TRUE

A join in which the joining condition is based on equality between values in the common column is called an equi-join.

TRUE

A major benefit of SQL as a standard is reduced training costs.

TRUE

A natural join is the same as an equi-join, except that it is performed over matching columns that have been defined with the same name, and one of the duplicate columns is eliminated.

TRUE

A procedure is run by calling it by its name.

TRUE

A transaction is the complete set of closely related update commands that must all be done, or none of them done, for the database to remain valid.

TRUE

Expressions are mathematical manipulations of data in a table that may be included as part of the SELECT statement.

TRUE

Figuring out what attributes you want in your query before you write the query will help with query writing.

TRUE

RDBMSs store database definition information in system-created tables which can be considered a data dictionary.

TRUE

The content of dynamic views is generated when they are referenced.

TRUE

The views are created by executing a CREATE VIEW SQL command.

TRUE

When EXISTS or NOT EXISTS is used in a subquery, the select list of the subquery will usually just select all columns as a placeholder because it doesn't matter which columns are returned.

TRUE

When a GROUP BY clause is included in an SQL statement, only those columns with a single value for each group can be included.

TRUE

When creating tables, it's important to decide which columns will allow null values before the table is created.

TRUE

Which of the following is true of the order in which SQL statements are evaluated?

The SELECT clause is processed before the ORDER BY clause.

entity integrity rule

The ________ states that no primary key attribute may be null. A) referential integrity constraint B) entity integrity rule C) partial specialization rule D) range domain rule

create table

The command for creating a database

no primary key attribute can be null.

The entity integrity rule states that: A) no primary key attribute can be null. B) referential integrity must be maintained across all entities. C) each entity must have a primary key. D) a primary key must have only one attribute

merge

The need to ________ relations commonly occurs when different views need to be integrated. A) metadata B) system C) drop D) merge

fourth normal form.

The normal form which deals with multivalued dependencies is called: A) fifth normal form. B) fourth normal form. C) Boyce-Codd normal form. D) sixth normal form.

Boyce-Codd normal form.

The normal form which removes any remaining functional dependencies because there was more than one primary key for the same nonkeys is called: A) fifth normal form. B) fourth normal form. C) Boyce-Codd normal form. D) sixth normal form.

identifying relationship

The relationship between a weak entity type and its owner

schema

The structure that contains descriptions of objects such as tables and views created by users.

Which of the following is a purpose of the SQL standard?

To specify syntax and semantics of SQL data definition and manipulation

) The following two SQL statements will produce the same results. Select last_name, first_name from customer where credit_limit > 99 and credit_limit < 10001; Select last_name, first_name from customer where credit_limit between 100 and 10000;

True

A database table is defined using the data definition language (DDL).

True

A major benefit of SQL as a standard is reduced training costs

True

Adding the DISTINCT keyword to a query eliminates duplicates.

True

An insert command does not need to have the fields listed.

True

Applications can be moved from one machine to another when each machine uses SQL

True

Expressions are mathematical manipulations of data in a table that may be included as part of the SELECT statement.

True

If multiple Boolean operators are used in an SQL statement, NOT is evaluated first, then AND, then OR.

True

In order to update data in SQL, one must inform the DBMS which relation, columns, and rows are involved.

True

One of the original purposes of the SQL standard was to provide a vehicle for portability of database definition and application modules between conforming DBMSs.

True

SQL is both an American and international standard for database access.

True

Some DBMS can handle graphic data types as well as text and numbers.

True

The WHERE clause is always processed before the GROUP BY clause when both occur in a SELECT statement.

True

The asterisk (*) wildcard designator can be used to select all fields from a table as well as in WHERE clauses when an exact match is not possible.

True

synonyms

Two or more attributes having different names but the same meaning are called: A) homonyms. B) aliases. C) synonyms. D) alternate attributes.

The ________ operator is used to combine the output from multiple queries into a single result table.

UNION

An anomaly is an error or inconsistency that may result when a user attempts to update a table that contains redundant data. There are three types of anomalies. An insert anomaly occurs when a user attempts to enter new information for part of a table. For example, if we stored customer address with an order. A deletion anomaly occurs when the user wants to delete part of a record but also has to delete related data. A modification anomaly occurs when we have to change the same data in multiple places

What is an anomaly, and what are the three types of anomalies?

create two new relations, one containing the multivalued attribute.

When a regular entity type contains a multivalued attribute, one must: A) create a single relation with multiple lines for each instance of the multivalued attribute. B) create two new relations, one containing the multivalued attribute. C) create two new relations, both containing the multivalued attribute. D) delete the relation and start over.

Given a table named store with 5 fields: store_id, address, city, state, zipcode, why would the following insert command not work? insert into store values ('234 Park Street')

You must specify the fields to insert if you are only inserting some of the fields.

Modification

________ are anomalies that can be caused by editing data in tables. A) Insertion B) Deletion C) Modification D) Creation

Physical

________ database specification indicates all the parameters for data storage that are then input to database implementation. A) Logical B) Physical C) Schematic D) Conceptual

The MERGE command:

allows one to combine the INSERT and UPDATE operations.

The SQL command ________ adds one or more new columns to a table.

alter table

A join in which the joining condition is based on equality between values in the common columns is called a(n):

both A and C.

In order for two queries to be UNION-compatible, they must:

both output compatible data types for each column and return the same number of rows.

A procedure is:

called by name.

User-defined data types:

can have defined functions and methods.

A join operation:

causes two tables with a common domain to be combined into a single table or view.

The command for creating a database is:

create schema.

The benefits of a standardized relational language include:

cross-system communication.

business rule

defines or constrains some aspect of the business. asserts business structure. controls or influences the behavior of the business.

A ________ is a temporary table used in the FROM clause of an SQL query.

derived table

To eliminate duplicate rows in a query, the ________ qualifier is used in the SQL Select command.

distinct

Any create command may be reversed by using a(n) ________ command.

drop

A ________ view is materialized when referenced.

dynamic

SQL-invoked routines can be:

functions or procedures.

Embedded SQL consists of:

hard-coded SQL statements included in a program written in another language.

The first in a series of steps to follow when creating a table is to:

identify each attribute and its characteristics.

One major advantage of the outer join is that:

information is not lost.

Dynamic SQL:

is used to generate appropriate SQL code on the fly as an application is processing.

Explicit commands to manage transactions are needed when:

multiple SQL commands must be run as part of a transaction.

A join that is based upon equality between values in two common columns with the same name and where one duplicate column has been removed is called a(n):

natural join.

The most commonly used form of join operation is the:

natural join.

A join in which rows that do not have matching values in common columns are still included in the result table is called a(n):

outer join.

Indexes are created in most RDBMSs to:

provide rapid random and sequential access to base-table data.

While triggers run automatically, ________ do not and have to be called.

routines

A single value returned from an SQL query that includes an aggregate function is called a(n):

scalar aggregate.

An operation to join a table to itself is called a(n):

self-join.

An interactive command that can be used to dynamically control a user session for appropriate integrity measures is:

set autocommit.

common types of entities are

strong entities. weak entities. associative entities.

SQL provides the ________ technique, which involves placing an inner query within the WHERE or HAVING clause of an outer query.

subquery

A type of query that is placed within a WHERE or HAVING clause of another query is called a:

subquery.

A view may not be updated directly if it contains:

the HAVING clause.

User-defined transactions can improve system performance because:

transactions are processed as sets, reducing system overhead.

A named set of SQL statements that are considered when a data modification occurs are called:

triggers.

The outer join syntax does not apply easily to a join condition of more than ________ tables.

two

EXISTS will take a value of ________ if the subquery returns an intermediate results table which contains one or more rows.

undefined

All of the following are guidelines for better query design EXCEPT:

use a lot of self-joins.

Establishing IF-THEN-ELSE logical processing within an SQL statement can be accomplished by:

using the CASE keyword in a statement.

Multiple values returned from an SQL query that includes an aggregate function are called:

vector aggregates.

RANK and DENSE-RANK are examples of:

window functions.

Implementation of a standard can never stifle creativity and innovation.

False

Indexes generally slow down access speed in most RDMS.

False

E-R diagram

There are two business rule(s) for every relationship.

In an SQL statement, which of the following parts states the conditions for row selection?

Where

Sam Hinz

Which of the following violates the atomic property of relations? A) Sam B) Hinz C) Sam Hinz D) Atomic

No two rows in a relation are identical.

Which of the following are properties of relations? A) Each attribute has the same name. B) No two rows in a relation are identical. C) There are multivalued attributes in a relation. D) All columns are numeric

Relations: Rules and Conventions

1 Cell 1 Value Columns store single type of information #, name, address, colour, etc. Column Names are Unique Rows are Unique Column and Row Order is insignificant

What does the following SQL statement do? Select * From Customer Where Cust_Type = "Best" A) Selects all the fields from the Customer table for each row with a customer labeled "Best" B) Selects the "*" field from the Customer table for each row with a customer labeled "Best" C) Selects fields with a "*" in them from the Customer table D) Selects all the fields from the Customer table for each row with a customer labeled "*"

A

equi-join/natural join

A join in which the joining condition is based on equality between values in the common columns

referential integrity constraint.

A rule that states that each foreign key value must match a primary key value in the other relation is called the: A) referential integrity constraint. B) key match rule. C) entity key group rule. D) foreign/primary match rule.

DML

A set of commands used to update and query a database.

Relation

A two-dimensional table of data sometimes is called a: A) group. B) set. C) declaration. D) relation.

What does the following SQL command do? insert into Customer_T values (001,'John Smith','231 West St','Boston','MA','02115')

Adds a new record to the Customer_T

Maximize Storage Pace

All of the following are the main goals of normalization EXCEPT: A) minimize data redundancy. B) simplify the enforcement of referential integrity. C) maximize storage space. D) make it easier to maintain data

Foreign Key

An attribute in a relation of a database that serves as the primary key of another relation in the same database is called a: A) link attribute. B) link key. C) foreign key. D) foreign attribute.

required attribute. (2)

An attribute of an entity that must have a value for each entity instance

composite attribute

An attribute that can be broken down into smaller parts

homonym

An attribute that may have more than one meaning is called a(n): A) homonym. B) alias. C) double defined attribute. D) synonym.

required attribute

An attribute that must have a value for every entity (or relationship) instance.

weak entity

An entity type whose existence depends on another entity type

In an SQL statement, which of the following parts states the conditions for row selection? A) Select B) From C) Where D) Group By

C

Indexes are created in most RDBMSs to: A) provide a quicker way to store data. B) decrease the amount of disk space utilized. C) provide rapid random and sequential access to base-table data. D) increase the cost of implementation

C

The SQL command ________ defines a logical table from one or more tables or views. A) create table B) alter table C) create view D) create relationship

C

What result set will the following query return? Select Item_No, description from item where weight > 100 and weight < 200; A) The Item_No and description for all items weighing less than 100 B) The Item_No for all items weighing between 101 and 199 C) The Item_No and description for all items weighing between 101 and 199 D) The Item_No for all items weighing more than 200

C

What will result from the following SQL Select statement? Select min(Product_Description) from Product_V; A) The minimum value of Product_Description will be displayed. B) An error message will be generated. C) The first product description alphabetically in Product_V will be shown. D) None of the above

C

Which of the following is true of the order in which SQL statements are evaluated? A) The SELECT clause is always processed first. B) The SELECT clause is always processed last. C) The SELECT clause is processed before the ORDER BY clause. D) The GROUP BY clause is processed before the WHERE clause

C

________ is a set of commands used to control a database, which includes security. A) DML B) DDL C) DCL D) DPL

C

Which of the following is a technique for optimizing the internal performance of the relational data model?

Clustering data

Database

Collection of organized Data

________ use the result of the outer query to determine the processing of the inner query.

Correlated subqueries

Which of the following counts ONLY rows that contain a value?

Count

entities

Customers, cars, and parts

A view may not be updated directly if it contains: A) the DISTINCT keyword. B) derived columns and expressions in the SELECT clause. C) uses the GROUP BY or HAVING clause. D) all of the above.

D

What result set will the following query return? Select Item_No from Order_V where quantity > 10; A) The Item_No of all orders that had more than 10 items B) The Order_Id of all orders that had more than one item C) The Order_Id of all orders that had more than 10 items D) The Item_No of all orders that had 10 or more items

D

If the DBA wishes to describe all tables in the database, which data dictionary view should be accessed in Oracle?

DBA_TABLES

The ________ DBA view shows information about all users of the database in Oracle.

DBA_USERS

________ is a set of commands used to control a database, including security.

DCL

Physical design

DDL is typically used during the phases of development process.

INSERT INTO is an example of ________ code.

DML

Data VS Information

Data-Data is raw, unorganized facts that need to be processed. Data can be something simple and seemingly random and useless until it is organized (Each student's test score is one piece of data.) Information- When data is processed, organized, structured or presented in a given context so as to make it useful, it is called information. (The average score of a class or of the entire school is information that can be derived from the given data.)

Each relation (or table) has a unique name. An entry at the intersection of each row and column is atomic and each row is unique. Each attribute (or column) within a table has a unique name. The sequence of rows and columns is insignificant

Discuss the properties of relations

During logical database design, normalization is used as a check and balance to make sure that your E-R diagram is correct as well as your relational schema before doing physical design. Another occasion when you benefit is reverse-engineering an older system, since many of the tables and user views are redundant.

Discuss the two major occasions when you benefit from using normalization

There are two possible cases for associative entities. In one case, you can have an identifier assigned. You would then use this as the primary key. The other case is where the identifier is not assigned. In this case, you would use the primary keys from the other two (or more) relations that are related to the associative entity.

Discuss the two possible scenarios when mapping an associative entity

The three major types of integrity constraints are domain constraints, entity integrity and referential integrity. A domain is a set of attributes assigned to an attribute and consists of the domain name, data type, size and allowable values. The entity integrity rule is designed to ensure that every relation has a primary key and that the data values for the primary key are valid (in particular, not null). The referential integrity constraint is a rule that maintains consistency among the rows of two relations. If there is a foreign key in one relation, there must be a matching primary key in the other relation or the foreign key must be null

Discuss the types of integrity constraints.

A primary key uniquely identifies each row of a relation (or table). It can be either a single column or a composite of two or more columns, which is called a composite key. A foreign key allows us to represent the relationship between two tables. A foreign key in one table is generally a reference to a primary key in another table

Discuss the various relational keys.

A surrogate key should be created when any of the following conditions hold: there is a composite primary key, the natural primary key is inefficient (such as a long name) or the natural primary key is recycled. When you have an associative entity, it is often best to use a surrogate key when you have more than two relations that the associative entity is related to, since the primary key would be a composite of the primary keys of all entities related to the associative entity.

Discuss when it is best to create a surrogate key for an associative entity

A multivalued attribute is one that can take on more than one value. According to the definition of a relation, there can be no multivalued attributes. The reason for this will be seen later when the schema is normalized. A multivalued attribute can be resolved by creating a separate instance for each value and repeating the data from the non-multivalued attributes

Discuss why it is important to remove multivalued attributes from a relation

A candidate key is an attribute or a combination of attributes that uniquely identifies a row in a relation. A candidate key must be nonredundant and must also uniquely identify each row. When we look at functional dependencies and candidate keys, we can always say that a determinant is always a candidate key.

Explain what a candidate key is and how it might be used

Indexes generally slow down access speed in most RDMS.

FALSE

It is better not to have a result set identified before writing GROUP BY and HAVING clauses for a query.

FALSE

Persistent Sorted Modules are extensions defined in SQL-99 that include the capability to create and drop modules of code stored in the database schema across user sessions.

FALSE

Specifying the attribute names in the SELECT statement will make it easier to find errors in queries and also correct for problems that may occur in the base system.

FALSE

Subqueries can only be used in the WHERE clause.

FALSE

The CREATE SCHEMA DDL command is used to create a table.

FALSE

The DROP command deletes rows from a table individually or in groups.

FALSE

The HAVING clause and the WHERE clause perform the same operation.

FALSE

The ORDER BY clause is the first statement processed in an SQL command.

FALSE

The WHERE clause is always processed before the GROUP BY clause when both occur in a SELECT statement.

FALSE

User-defined functions can improve system performance because they will be processed as sets rather than individually, thus reducing system overhead.

FALSE

When the SELECT clause in the create view statement contains the keyword DISTINCT, the view can be used to update data.

FALSE

SQL has been implemented only in the mainframe and midrange environments.

False

History of Databases- 1980s

In 1983 IBM finally released a full-fledged commercial relational database DB2 for mainframes. But it was too late for IBM to dominate the mini computer market, and Oracle was already selling to IBM's customers Its success helped relational databases became the way much of our computer data is organized

History of Databases- 1990s

In 1990 a shakedown of the database industry left only a few companies, these companies now started to sell complex database products at a high prices. In 1990 a shakedown of the database industry left only a few companies, these companies now started to sell complex database products at a high prices. it was 1995 when the first internet database application was made. The advent of the Internet led to exponential growth of the database industry

create table

In the SQL language, the ________ statement is used to make table definitions. A) create session B) create table C) create index D) select

Candidate

In the figure below, Customer_ID in the CUSTOMER Table is which type of key? A) Composite B) Candidate C) Standard D) Grouped

An associative entity

In the figure below, what is depicted? A) A one-to-one relationship B) A unary relationship C) A one-to-many relationship D) An associative entity

Strong entity/weak entity

In the figure below, what type of relationship do the relations depict? A) Strong entity/weak entity B) Multivalued C) Composite foreign key D) One-to-many

one-to-Many

In the figure below, what type of relationship do the relations depict? A) Strong entity/weak entity B) One-to-many C) Ternary D) Many-to-many

Keys: Unique and Non-Unique

Key is a column within a relation whose entries are used to identify a row Non-Unique Key: -Data value may be shared among several rows -Consequently, the key will identify a set of rows Unique Key: -Data value is unique for each row -Consequently, the key will uniquely identify a row

There are six different normal forms, all of which build upon each other. When a relation is in first normal form, all repeating groups have been removed. Second normal form means that any partial functional dependencies have been removed. A partial functional dependency occurs when a primary key is a composite key and a nonkey attribute is dependent upon part of the key. A relation is in third normal form when all transitive dependencies have been resolved. A transitive dependency occurs when one nonkey attribute is dependent upon another nonkey attribute. Boyce-Codd normal form removes any further dependencies that may result from anomalies. A relation is in fourth normal form when any dependencies from multivalued attributes have been removed. Fifth normal form removes any further anomalies. LO: 4.8: Use normalization to decompose a relation with anomalies into well-structured

List and explain 1st, 2nd, 3rd, BCNF, 4th, and 5th normal forms

entity-relationship model

Logical representation of an organization's data.

The last part of an SQL query to be read is the ________ statement.

ORDER BY

To get all the customers from Hawaii sorted together, which of the following would be used?

ORDER BY

A component is always used in only one item.

Referring to the figure below, which of the following is NOT true? A) A component is part of an item. B) A component is always used in only one item. C) A component can be part of an item. D) A component may be used in many items

Which of the following will produce the minimum of all standard prices?

Select min(standard_price) from Product_V;

A trigger is a named set of SQL statements that are considered when a data modification occurs.

TRUE

Adding the DISTINCT keyword to a query eliminates duplicates.

TRUE

An SQL query that implements an outer join will return rows that do not have matching values in common columns.

TRUE

An insert command does not need to have the fields listed.

TRUE

Applications can be moved from one machine to another when each machine uses SQL.

TRUE

Constraints are a special case of triggers.

TRUE

Correlated subqueries are less efficient than queries that do not use nesting.

TRUE

Establishing IF-THEN-ELSE logical processing within an SQL statement can now be accomplished by using the CASE keyword in a statement.

TRUE

If multiple Boolean operators are used in an SQL statement, NOT is evaluated first, then AND, then OR.

TRUE

In order to find out what customers have not placed an order for a particular item, one might use the NOT qualifier along with the IN qualifier.

TRUE

In order to update data in SQL, one must inform the DBMS which relation, columns, and rows are involved.

TRUE

Joining tables or using a subquery may produce the same result.

TRUE

One of the original purposes of the SQL standard was to provide a vehicle for portability of database definition and application modules between conforming DBMSs.

TRUE

SQL statements can be included in another language, such as C or Java.

TRUE

SQL:2008 allows one to calculate linear regressions, moving averages and correlations without moving the data outside of the database.

TRUE

Some DBMS can handle graphic data types as well as text and numbers.

TRUE

The ALTER TABLE command is used to change a table definition.

TRUE

The FROM clause is the first statement processed in an SQL command.

TRUE

The ORDER BY clause sorts the final results rows in ascending or descending order.

TRUE

The SQL command used to populate tables is the INSERT command.

TRUE

The UNION clause is used to combine the output from multiple queries into a single result table.

TRUE

The advantages of SQL-invoked routines are flexibility, efficiency, shareability and applicability.

TRUE

The asterisk (*) wildcard designator can be used to select all fields from a table as well as in WHERE clauses when an exact match is not possible.

TRUE

The joining condition of an equi-join is based upon an equality.

TRUE

determinant.

The attribute on the left-hand side of the arrow in a functional dependency is the: A) candidate key. B) determinant. C) foreign key. D) primary key.

The SQL command used to populate tables is the INSERT command.

True

The WHERE clause includes the conditions for row selection within a single table or view and the conditions between tables or views for joining.

True

The content of dynamic views is generated when they are referenced

True

The following query totals sales for each salesperson. Select salesperson_id, sum(sales) from salesperson group by salesperson_id;

True

The views are created by executing a CREATE VIEW SQL command.

True

entity type name should be all of the following

concise. specific to the organization. A singular noun.

In SQL, a(n) ________ subquery is a type of subquery in which processing the inner query depends on data from the outer query.

correlated

The SQL command ________ defines a logical table from one or more tables or views.

create view

The ________ is the structure that contains descriptions of objects such as tables and views created by users.

schema

All of the following are part of the coding structure for triggers EXCEPT:

selection.

A type of join where a table is joined to itself is called a(n):

self-join.

History of Databases- 1970s

-1970s: 1970 to 1972: Ted Codd published an important paper to propose the use of a relational database model Codd's relational data base model started competing with another IBM database, IMS. This caused for IBM to be slow when starting to support this new idea. In 1973 Michael Stonebreakers team at UBC used Codd's idea to create the Ingres relational database In 1975 IBM produced an experimental relational database named system R, it used a structured query language developed by Don Chamberlin and Raymond Boyce In 1977 A young entrepreneur named Larry Ellison put up $2000 of his own money to start a software company with Bob Miner and Ed Oats. The first version ran on mini computers, but by 1983 the company had re-written it to run on more computer systems including IBM PC's and mainframes

A single value returned from an SQL query that includes an aggregate function is called a(n):

*A. scalar aggregate.* B. agate. C. summation. D. vector aggregate.

History of Databases (first example and the 1960s)

-First example of a database was found through a Sumerian tablet with a index of medical prescriptions, could have been anywhere from 4000 BC- 1000 BC. -1960s: Computerized database started in the 1960s Early computer database models followed a flat file model This format required that computers begin their search at the start of the list and search sequentially In the mid 1960's IBM created a hierarchical model for their information management system, IMS. This tree like structure with parent nodes pointing to child nodes was successfully used by Nasa to create drawings for the lunar lander. Charles Bachman modified the database model allowing for child nodes to have multiple parents

How we interact with data

1. Querying (Create) 2. Creating (Read) 3. Modifying (Update) 4. Deleting (Delete) (think of the acronym 'CRUD")

Why not lists?

1. Redundancy Slower Bigger 2. Multiple Themes Leads to Data Anomalies Deletion Update Insertion

standardized relational language

1. application longevity. 2. reduced training costs. 3. cross-system communication.

SQL standard

1.To specify syntax and semantics of SQL data definition and manipulation 2.To specify minimal and complete standards, which permit different degrees of adoption in products 3.To define the data structures and basic operations for SQL databases

Multiple values returned from an SQL query that includes an aggregate function are called: A) vector aggregates. B) scalar aggregates. C) agates. D) summations

A

To get all the customers from Hawaii sorted together, which of the following would be used? A) ORDER BY B) GROUP BY C) HAVING D) SORT

A

What does the following SQL command do? insert into Customer_T values (001,'John Smith','231 West St','Boston','MA','02115'); A) Adds a new record to the Customer_T B) Creates the Customer_T table C) Deletes the Customer_T table D) Updates the Customer_T table

A

What does the following SQL statement do? Delete from Customer_T where state = 'HI'; A) Deletes all records from customer_t where the state is equal to HI B) Removes the Customer_T table from the database C) Deletes all records from the Customer_T table D) None of the above

A

the key must indicate the row's position in the table

A candidate key must satisfy all of the following conditions EXCEPT: A) the key must uniquely identify the row. B) the key must indicate the row's position in the table. C) the key must be nonredundant. D) each nonkey attribute is functionally dependent upon it.

transitive dependency.

A functional dependency between two or more nonkey attributes is called a: A) partial functional dependency. B) partial nonkey dependency. C) transitive dependency. D) partial transitive dependency.

partial functional

A functional dependency in which one or more nonkey attributes are functionally dependent on part, but not all, of the primary key is called a ________ dependency. A) partial key-based B) partial functional C) cross key D) merged relation

well-structured

A relation that contains minimal redundancy and allows easy use is considered to be: A) clean. B) simple. C) complex. D) well-structured

Second

A relation that contains no multivalued attributes and has nonkey attributes solely dependent on the primary key but contains transitive dependencies is in which normal form? A) First B) Second C) Third D) Fourth

In which of the following situations would one have to use an outer join in order to obtain the desired results?

A report is desired that lists all customers and the total of their orders during the most recent month, and includes customers who did not place an order during the month (their total will be zero).

What will be returned when the following SQL query is executed? Select driver_no, count(*) as num_deliveries from deliveries group by driver_no having count(*) > 2;

A. A listing of all drivers who made more than 2 deliveries *B. A listing of all drivers who made more than 2 deliveries as well as a count of the number of deliveries* C. A listing of the number of deliveries greater than 2 D. A listing of all drivers

What does the following SQL statement do? Alter Table Customer_T Add (Type Varchar (2));

A. Alters the Customer_T table to be a Type 2 Varchar B. Alters the Customer_T table by adding a 2-byte field called "Varchar" C. Alters the Customer_T table to accept Type 2 Varchars *D. Alters the Customer_T table, and adds a field called "Type"*

INSERT INTO is an example of ________ code.

A. DCL B. DDL C. TIO *D. DML*

What does the following SQL statement do? Delete from Customer_T where state = 'HI';

A. Deletes all records from the Customer_T table B. Doesn't delete anything because of a syntax error *C. Deletes all records from customer_t where the state is equal to HI* D. Removes the Customer_T table from the database

Requiring a CustomerID to exist in a Primary table before it can exist in a foreign table is an example of:

A. Ethical Integrity. *B. Referential Integrity.* C. the Hoffer Principle. D. Referential Referring.

Which of the following can produce scalar and vector aggregates?

A. ORDER BY B. SORT *C. GROUP BY* D. HAVING

Which of the following is true of the order in which SQL statements are evaluated?

A. The GROUP BY clause is processed before the WHERE clause. *B. The SELECT clause is processed before the ORDER BY clause.* C. The SELECT clause is always processed first. D. The SELECT clause is always processed last.

What result set will the following query return? Select Item_No from Order_V where quantity > 10;

A. The Item_No of all orders that had 10 or more items B. The Order_Id of all orders that had more than 10 items *C. The Item_No of all orders that had more than 10 items* D. The Order_Id of all orders that had more than one item

fact

Association between two or more terms.

A ________ view is materialized when referenced. A) virtual B) dynamic C) materialized D) base

B

A single value returned from an SQL query that includes an aggregate function is called a(n): A) agate. B) scalar aggregate. C) vector aggregate. D) summation.

B

Any create command may be reversed by using a ________ command. A) truncate B) drop C) delete D) unpack

B

DDL is typically used during which phases of the development process? A) Implementation B) Physical design C) Analysis D) All of the above

B

Given a table named store with 5 fields: store_id, address, city, state, zipcode, why would the following insert command not work? insert into store values ('234 Park Street') A) It would work just fine. B) You must specify the fields to insert if you are only inserting some of the fields. C) There is no table keyword. D) None of the above.

B

The SQL command ________ adds one or more new columns to a table. A) create table B) alter table C) create view D) create relationship

B

The ________ is the structure that contains descriptions of objects such as tables and views created by users. A) SQL B) schema C) catalog D) master view

B

The first in a series of steps to follow when creating a table is to: A) identify columns that must be unique. B) identify each attribute and its characteristics. C) create an index. D) identify columns that must be null

B

To eliminate duplicate rows in a query, the ________ qualifier is used in the SQL Select command. A) alter B) distinct C) check D) specific

B

What does the following SQL statement do? Update Product_T Set Unit_Price = 775 Where Product_ID = 7 A) Changes the price of a unit called Product_T to 7 B) Changes the unit price of Product 7 to 775 C) Changes the length of the Unit_Price field to 775 D) Updates the Product_T table to have a unit price of 775

B

What result set is returned from the following query? Select Customer_Name, telephone from customers where city in ('Boston','New York','Denver'); A) The Customer_Name and telephone of all customers B) The Customer_Name and telephone of all customers living in either Boston, New York or Denver C) The Customer_Name and telephone of all customers living in Boston and New York and Denver D) The Customer_Name of all customers living in Boston, New York or Denver

B

What result will the following SQL statement produce? Select Avg(standard_price) as average from Product_V; A) The average of all products in Product_V B) The average Standard_Price of all products in Product_V C) The average price of all products D) None of the above

B

What will be returned when the following SQL statement is executed? Select driver_no, count(*) as num_deliveries from deliveries where state = 'MA' group by driver_no; A) A listing of all drivers who made deliveries to state = 'MA', sorted by driver number B) A listing of each driver who made deliveries to state = 'MA' as well as the number of deliveries that each driver has made to that state C) A count of all of the deliveries made to state = 'MA' by all drivers D) None of the above

B

Which of the following can produce scalar and vector aggregates? A) ORDER BY B) GROUP BY C) HAVING D) SORT

B

Which of the following is a technique for optimizing the internal performance of the relational data model? A) Avoiding indexes on secondary keys B) Clustering data C) Not reporting statistics to save machine resources D) Using random index organizations

B

Which of the following is the wildcard operator in SQL statements? A) < > B) * C) = D) &

B

Which of the following questions is answered by the SQL statement? Select Count (Product_Description) from Product_T; A) How many products are in the table Product_T? B) How many products have product descriptions in the Product Table? C) How many characters are in the field name "Product_Description"? D) How many different columns named "Product_Description" are there in table Product_T?

B

Which of the following will produce the minimum of all standard prices? A) Select standard_price from Product_V where Standard_Price = min; B) Select min(standard_price) from Product_V; C) Select Standard_Price from min(Product_V); D) Select min(Standard_Price) from Product_V where Standard_Price = min(Standard_Price);

B

The command for creating a database is: A) create table. B) create view. C) create schema. D) create authorization.

C

Which of the following finds all groups meeting stated conditions? A) Select B) Where C) Having D) Find

C

MULTISET is similar to the table datatype.

FALSE

Materialized views are stored on disk and are never refreshed.

FALSE

One major disadvantage of the outer join is that information is easily lost.

FALSE

SQL has been implemented only in the mainframe and midrange environments.

FALSE

Using an outer join produces this information: rows that do not have matching values in common columns are not included in the result table.

FALSE

When a subquery is used in the FROM clause, it is called a denied table.

FALSE

When creating a table, it is not important to consider foreign key—primary key mates.

FALSE

The DELETE TABLE DDL command is used to remove a table from the database.

False

The DROP command deletes rows from a table individually or in groups.

False

When creating a table, it is not important to consider foreign key—primary key mates.

False

When the SELECT clause in the create view statement contains the keyword DISTINCT, the view can be used to update data.

False

Which of the following finds all groups meeting stated conditions?

Having

A weak entity becomes a relation. However, since a weak entity instance does not exist by itself, we must create a relation with the primary key from the strong relation as the primary key, as well as the identifying attribute.

How do you convert weak entities to relations?

Which of the following questions is answered by the SQL statement? Select Count (Product_Description) from Product_T

How many products have product descriptions in the Product Table?

The first in a series of steps to follow when creating a table

Identify each attribute and its characteristics.

4Requiring a CustomerID to exist in a Primary table before it can exist in a foreign table is an example of:

Referential Integrity.

data name

Relates to business characteristics Readable Repeatable

Persistent Stored Modules are extensions defined in SQL:1999 that include the capability to add and drop modules of code.

TRUE

SQL is both an American and international standard for database access.

TRUE

What result will the following SQL statement produce? Select Avg(standard_price) as average from Product_V

The average Standard_Price of all products in Product_V

Ternary

The figure below is an example of mapping which type of relationship? A) First B) Second C) Unary D) Ternary

The ALTER TABLE command is used to change a table definition.

True

The FROM clause is the first statement processed in an SQL command.

True

The ORDER BY clause sorts the final results rows in ascending or descending order.

True

When a GROUP BY clause is included in an SQL statement, only those columns with a single value for each group can be included.

True

When creating tables, it's important to decide which columns will allow null values before the table is created.

True

one must be able to check the output of a CASE tool.

Understanding the steps involved in transforming EER diagrams into relations is important because: A) one must be able to check the output of a CASE tool. B) there are rarely legitimate alternatives from which to choose. C) CASE tools can model any situation. D) CASE tools model hypothetical business problems

Database System Components

Users Database Applications Database Management Systems (DBMS) Database

First normal form

When all multivalued attributes have been removed from a relation, it is said to be in: A) first normal form. B) second normal form. C) Boyce-Codd normal form. D) third normal form

Data integrity

________ is a component of the relational data model included to specify business rules to maintain the integrity of data when they are manipulated. A) Business rule constraint B) Data integrity C) Business integrity D) Data structure

Deletion

________ problems are encountered when removing data with transitive dependencies. A) Insertion B) Modification C) Deletion D) Merging

The UNION clause is used to:

combine the output from multiple queries into a single result table.

All of the following are advantages of SQL-invoked routines EXCEPT:

security.

What results will be produced by the following SQL query? Select sum(standard_price) as Total_Price from Product_V where Product_Type = 'WOOD'; A) The total price of all products that are of type wood B) The total price of all products C) The Standard_Price of the first wood product in the table D) The Standard_Price of any wood product in the table

A

What will be returned when the following SQL query is executed? Select driver_no, count(*) as num_deliveries from deliveries group by driver_no having count(*) > 2; A) A listing of all drivers who made more than 2 deliveries as well as a count of the number of deliveries B) A listing of all drivers C) A listing of the number of deliveries greater than 2 D) A listing of all drivers who made more than 2 deliveries

A

Which of the following counts ONLY rows that contain a value? A) Count B) Count(*) C) Tally(*) D) Checknum

A

________ is a set of commands used to update and query a database. A) DML B) DDL C) DCL D) DPL

A

DCL

A set of commands used to control a database, which includes security.

union join.

A type of join implemented in SQL-1999 and by extension SQL 2003 that returns all of the data from each table that is joined

self join

A type of join where a table is joined to itself.

What does the following SQL command do? insert into Customer_T values (001,'John Smith','231 West St','Boston','MA','02115');

A. Updates the Customer_T table *B. Adds a new record to the Customer_T table* C. Creates the Customer_T table D. Deletes the Customer_T table

Multiple values returned from an SQL query that includes an aggregate function are called:

A. agates. B. scalar aggregates. C. summations. *D. vector aggregates.*

The benefits of a standardized relational language include:

A. application turnover. B. increased training costs. C. confusing the SQL programmers. *D. cross-system communication.*

The command for creating a database is:

A. create authorization. B. create table. *C. create schema.* D. create view.

The SQL command ________ defines a logical table from one or more tables or views.

A. create relationship B. alter table *C. create view* D. create table

Two relations are created. One represents the entity type in the relationship, and the other is an associative relation to represent the M:N relationship. The primary key of the associative relation consists of two attributes which take their value from the primary key of the other relation.

Discuss how to map a unary many-to-many relationship.

The entity type in the unary relationship is mapped to a relation in the same way as we did for a relation. We next add a foreign key attribute, which maps back to the primary key. This is called a recursive foreign key. So, if we had a relation such as a person supervises one or more persons, the person_id would be a primary key and then there would be a supervisor id which points back to the person_id

Discuss how to map a unary one-to-many relationship.

Each regular entity is transformed into a relation. There are a couple of things that need to be done with some special types of attributes. Composite attributes are broken down into their individual components. Multivalued attributes are broken down into separate relations. For example, if there was a multivalued skill attribute, this would become a skill relation. Also, we ignore derived attributes.

Discuss how you would map a regular entity to a relation.

Why Are Keys Important?

Ensure that each record in table is precisely identified Help establish and enforce various types of integrity (security or protection) Establish table relationships

When we have a supertype/subtype relationship, we need to assign one entity for the supertype and one for each subtype. The supertype has all attributes common to all subtypes as well as a primary key. Each subtype relation has the primary key of the supertype as well as any attributes that are specific to that subtype. Finally, we assign one or more attributes to the supertype to function as subtype discriminators

Explain how subtype/supertype relationships are converted to relations

The comparison operators = and != are used to establish a range of values.

FALSE

The following insert command would work fine: insert into budget values 121,222,111

FALSE

The natural join is very rarely used.

FALSE

There is a special operation in SQL to join a table to itself.

FALSE

Transaction integrity commands are not used to identify whole units of database changes that must be completed in full for the database to retain integrity.

FALSE

Triggers can be used to ensure referential integrity, enforce business rules, create audit trails and replicate tables, but cannot call other triggers.

FALSE

Materialized views are stored on disk and are never refreshed.

False

The HAVING clause and the WHERE clause perform the same operation.

False

The ORDER BY clause is the first statement processed in an SQL command.

False

The comparison operators = and != are used to establish a range of values.

False

The following command would work fine: insert into budget values 121,222,111;

False

The following query totals sales in state= 'MA' for each salesperson. Select salesperson_id, sum(sales) from salesperson group by salesperson_id having state = 'MA';

False

The following two SQL statements will produce different results. Select last_name, first_name from customer where state = 'MA' or state = 'NY' or state = 'NJ' or state = 'NH' or state = 'CT'; Select last_name, first_name from customer where state in ('MA','NY','NJ','NH','CT');

False


Set pelajaran terkait

Algebra 2 B - Unit 2: Exponential and Logarithmic Functions, Part 2

View Set

GENERAL INS REGULATIONS-PRODUCER'S LICENSE MAINTENANCE

View Set

Module 2: Pregunta, Variables, Hipótesis y Revisión Bibliográfica

View Set

Unit Circle Trig Values - Quadrant II

View Set