SlideShare utilise les cookies pour améliorer les fonctionnalités et les performances, et également pour vous montrer des publicités pertinentes. Si vous continuez à naviguer sur ce site, vous acceptez l’utilisation de cookies. Consultez nos Conditions d’utilisation et notre Politique de confidentialité.
SlideShare utilise les cookies pour améliorer les fonctionnalités et les performances, et également pour vous montrer des publicités pertinentes. Si vous continuez à naviguer sur ce site, vous acceptez l’utilisation de cookies. Consultez notre Politique de confidentialité et nos Conditions d’utilisation pour en savoir plus.
04 Quiz 1 Answer Key *Property of STI
Page 1 of 2
PROBLEM SET. Provide the answer for each question. (5 pts. each)
1. Define database.
A database is a collection of data organized in a structured format defined by metadata
that describes the structure.
2. Differentiate the first normal form from the second normal form.
According to the first normal form, each attribute of a tuple must contain only one
value, each tuple in a relation must contain the same number of values and each tuple in a
relation must be different. According to the second normal form, a relation must be in first
normal form and all attributes in a relation must be dependent on the entire candidate key.
3. Enumerate the three primary types of relationships supported by a relational database.
4. Differentiate a DDL statement from a DML statement.
DDL statements are used to create, modify, and delete database objects such as tables,
views, schemas, domains, triggers, and stored procedures. DML statements are used to view,
add, modify or delete data stored in the database objects.
5. Define schema.
A schema is a set of related objects that are collected under a common namespace.
The schema acts as a container for those objects, which in turn store the SQL data or perform
other data-related functions.
6. Assume that you are writing a SELECT statement that retrieves the CDTitle column and all rows
from the Inventory table. You want the column in the query results to be named CompactDisc.
Provide the SELECT statement that you will use.
SELECT CDTitle AS CompactDisc FROM Inventory;
7. Assume that you are writing a SELECT statement that retrieves the Category and Price columns
from the CompactDiscStock table. You want to group together the data first by the Category
column and then by the Price column. And then you want to filter out any groups that have a
Price value over 15.99. Provide the SELECT statement that you will use.
SELECT Category, Price FROM CompactDiscStock
GROUP BY Category, Price
HAVING Price < 16.00 ;
8. Assume that you are creating an INSERT statement to insert data into the ArtistTypes table. The
table includes only two columns: ArtID and TypeName. You want to insert one row that includes
the ArtID value of 27 and the TypeName value of Gospel. Provide SQL statement that you will
INSERT INTO ArtistTypes VALUES ( 27, 'Gospel' ) ;
9. Assume that you are creating an UPDATE statement to update data in the PerformingArtists
table. And you want to update the ArtID value of every row to 27. Provide SQL statement that
you will use.
UPDATE PerformingArtists SET ArtID = 27 ;
04 Quiz 1 Answer Key *Property of STI
Page 2 of 2
10. Differentiate an inner join from an outer join.
The inner join combines two tables having a common column which is usually the
primary key. An outer join produces all rows that exist in one table, even if there are
corresponding rows that do not exist in the joined table. In most implementations, the outer
join is broken down into joins called left outer join, right outer join, and full outer join. The
outer join in these implementations is normally optional.
11. Define recursive common table expression.
Recursive common table expressions allow you to query tables that represent
hierarchical information such as reporting relationships within a company. Common table
expressions are recursive when the RECURSIVE keyword appears immediately after WITH.
Recursive common table expressions provide a convenient way to write queries that return
relationships to an arbitrary depth. For example, given a table that represents the reporting
relationships within a company, you can readily write a query that returns all the employees
that report to one particular person.
12. Differentiate a ROLLUP operation from a CUBE operation.
The ROLLUP operation is used when you want to get a result set showing totals and
subtotals. It adds subtotal rows into the result sets of queries with GROUP BY clauses. ROLLUP
generates a result set showing aggregates for a hierarchy of values. The CUBE operation is
useful when you want to work with a large amount of data in your reports. The CUBE operator
provides subtotals of aggregate values in the result set. It produces subtotals for all possible
combinations of the columns listed in the group by clause. When the CUBE operation is
performed on variables, the result set includes many subtotal rows based on combinations of the
values of the variables.